-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding template and integration tests
- Loading branch information
1 parent
b80e846
commit b249a08
Showing
4 changed files
with
254 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
tests/helm/testdata/goldenfile/metadata_metrics_otc/allow_histograms.input.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sumologic: | ||
metrics: | ||
allowHistogramRegex: "^(apiserver_request_duration_seconds)$" |
204 changes: 204 additions & 0 deletions
204
tests/helm/testdata/goldenfile/metadata_metrics_otc/allow_histograms.output.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
--- | ||
# Source: sumologic/templates/metrics/otelcol/configmap.yaml | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: release-name-sumologic-otelcol-metrics | ||
namespace: default | ||
labels: | ||
app: release-name-sumologic-otelcol-metrics | ||
chart: "sumologic-4.9.0" | ||
release: "release-name" | ||
heritage: "Helm" | ||
data: | ||
config.yaml: | | ||
exporters: | ||
sumologic/default: | ||
client: k8s_4.9.0 | ||
decompose_otlp_histograms: true | ||
endpoint: ${SUMO_ENDPOINT_DEFAULT_OTLP_METRICS_SOURCE} | ||
max_request_body_size: 16777216 | ||
metric_format: otlp | ||
sending_queue: | ||
enabled: true | ||
num_consumers: 10 | ||
queue_size: 10000 | ||
storage: file_storage | ||
timeout: 30s | ||
extensions: | ||
file_storage: | ||
compaction: | ||
directory: /tmp | ||
on_rebound: true | ||
directory: /var/lib/storage/otc | ||
timeout: 10s | ||
health_check: {} | ||
pprof: {} | ||
processors: | ||
batch: | ||
send_batch_max_size: 2048 | ||
send_batch_size: 1024 | ||
timeout: 1s | ||
filter/drop_unnecessary_metrics: | ||
error_mode: ignore | ||
metrics: | ||
metric: | ||
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*") | ||
- (not IsMatch(name, "^(apiserver_request_duration_seconds)$")) and (type == | ||
METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM | ||
or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")) | ||
groupbyattrs: | ||
keys: | ||
- container | ||
- namespace | ||
- pod | ||
- service | ||
groupbyattrs/group_by_name: | ||
keys: | ||
- __name__ | ||
- job | ||
k8s_tagger: | ||
extract: | ||
delimiter: _ | ||
labels: | ||
- key: '*' | ||
tag_name: pod_labels_%s | ||
metadata: | ||
- daemonSetName | ||
- deploymentName | ||
- nodeName | ||
- replicaSetName | ||
- serviceName | ||
- statefulSetName | ||
owner_lookup_enabled: true | ||
passthrough: false | ||
pod_association: | ||
- from: build_hostname | ||
memory_limiter: | ||
check_interval: 5s | ||
limit_percentage: 90 | ||
spike_limit_percentage: 20 | ||
metricstransform: | ||
transforms: | ||
action: update | ||
include: ^prometheus_remote_write_(.*)$$ | ||
match_type: regexp | ||
new_name: $$1 | ||
resource: | ||
attributes: | ||
- action: upsert | ||
from_attribute: namespace | ||
key: k8s.namespace.name | ||
- action: delete | ||
key: namespace | ||
- action: upsert | ||
from_attribute: pod | ||
key: k8s.pod.name | ||
- action: delete | ||
key: pod | ||
- action: upsert | ||
from_attribute: container | ||
key: k8s.container.name | ||
- action: delete | ||
key: container | ||
- action: upsert | ||
from_attribute: node | ||
key: k8s.node.name | ||
- action: delete | ||
key: node | ||
- action: upsert | ||
from_attribute: service | ||
key: prometheus_service | ||
- action: delete | ||
key: service | ||
- action: upsert | ||
from_attribute: service.name | ||
key: job | ||
- action: delete | ||
key: service.name | ||
- action: upsert | ||
key: _origin | ||
value: kubernetes | ||
- action: upsert | ||
key: cluster | ||
value: kubernetes | ||
resource/delete_source_metadata: | ||
attributes: | ||
- action: delete | ||
key: _sourceCategory | ||
- action: delete | ||
key: _sourceHost | ||
- action: delete | ||
key: _sourceName | ||
resource/remove_k8s_pod_pod_name: | ||
attributes: | ||
- action: delete | ||
key: k8s.pod.pod_name | ||
source: | ||
collector: kubernetes | ||
exclude: | ||
k8s.namespace.name: "" | ||
sumologic: | ||
add_cloud_namespace: false | ||
transform/remove_name: | ||
error_mode: ignore | ||
metric_statements: | ||
- context: resource | ||
statements: | ||
- delete_key(attributes, "__name__") | ||
transform/set_name: | ||
error_mode: ignore | ||
metric_statements: | ||
- context: datapoint | ||
statements: | ||
- set(attributes["__name__"], metric.name) where IsMatch(metric.name, "^cloudprovider_.*") | ||
receivers: | ||
otlp: | ||
protocols: | ||
http: | ||
endpoint: 0.0.0.0:4318 | ||
telegraf: | ||
agent_config: | | ||
[agent] | ||
interval = "30s" | ||
flush_interval = "30s" | ||
omit_hostname = true | ||
[[inputs.http_listener_v2]] | ||
# wait longer than prometheus | ||
read_timeout = "30s" | ||
write_timeout = "30s" | ||
service_address = ":9888" | ||
data_format = "prometheusremotewrite" | ||
paths = [ | ||
"/prometheus.metrics" | ||
] | ||
service: | ||
extensions: | ||
- health_check | ||
- file_storage | ||
- pprof | ||
pipelines: | ||
metrics: | ||
exporters: | ||
- sumologic/default | ||
processors: | ||
- memory_limiter | ||
- metricstransform | ||
- groupbyattrs | ||
- resource | ||
- k8s_tagger | ||
- source | ||
- sumologic | ||
- resource/remove_k8s_pod_pod_name | ||
- resource/delete_source_metadata | ||
- transform/set_name | ||
- groupbyattrs/group_by_name | ||
- transform/remove_name | ||
- filter/drop_unnecessary_metrics | ||
- batch | ||
receivers: | ||
- telegraf | ||
- otlp | ||
telemetry: | ||
logs: | ||
level: info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//go:build allversions | ||
// +build allversions | ||
|
||
package integration | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/SumoLogic/sumologic-kubernetes-collection/tests/integration/internal" | ||
"github.com/SumoLogic/sumologic-kubernetes-collection/tests/integration/internal/stepfuncs" | ||
) | ||
|
||
func Test_Helm_OT_Histograms(t *testing.T) { | ||
|
||
expectedMetrics := internal.DefaultExpectedMetrics | ||
// we have tracing enabled, so check tracing-specific metrics | ||
expectedMetrics = append(expectedMetrics, internal.TracingOtelcolMetrics...) | ||
|
||
installChecks := []featureCheck{ | ||
CheckSumologicSecret(15), | ||
CheckOtelcolMetadataLogsInstall, | ||
CheckOtelcolMetadataMetricsInstall, | ||
CheckOtelcolEventsInstall, | ||
CheckOtelcolMetricsCollectorInstall, | ||
CheckOtelcolLogsCollectorInstall, | ||
CheckTracesInstall, | ||
} | ||
|
||
featInstall := GetInstallFeature(installChecks) | ||
|
||
featMetrics := GetMetricsFeature(expectedMetrics, Otelcol) | ||
|
||
featTelegrafMetrics := GetTelegrafMetricsFeature(internal.DefaultExpectedNginxAnnotatedMetrics, Otelcol, true) | ||
|
||
featLogs := GetAllLogsFeature(stepfuncs.WaitUntilExpectedExactLogsPresent, true) | ||
|
||
featMultilineLogs := GetMultipleMultilineLogsFeature() | ||
|
||
featEvents := GetEventsFeature() | ||
|
||
featTraces := GetTracesFeature() | ||
|
||
testenv.Test(t, featInstall, featMetrics, featTelegrafMetrics, featLogs, featMultilineLogs, featEvents, featTraces) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sumologic: | ||
metrics: | ||
allowHistogramRegex: "^(apiserver_request_duration_seconds)$" |