From c700706c892bcb81455f4ebd85eb96ec7f57835a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Thu, 21 Sep 2023 17:17:26 +0200 Subject: [PATCH] fix(metrics)!: drop k8s.node.name attribute Use the `node` attribute instead. This was only part of the metrics metadata by mistake. --- .changelog/3295.fixed.txt | 1 + deploy/helm/sumologic/conf/metrics/otelcol/processors.yaml | 5 +++++ docs/v4-migration-doc.md | 4 ++++ .../metadata_metrics_otc/additional_endpoints.output.yaml | 5 +++++ .../goldenfile/metadata_metrics_otc/basic.output.yaml | 5 +++++ .../goldenfile/metadata_metrics_otc/custom.output.yaml | 5 +++++ .../metadata_metrics_otc/filtered_app_metrics.output.yaml | 5 +++++ tests/integration/features.go | 3 --- 8 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .changelog/3295.fixed.txt diff --git a/.changelog/3295.fixed.txt b/.changelog/3295.fixed.txt new file mode 100644 index 0000000000..1c7b41d72d --- /dev/null +++ b/.changelog/3295.fixed.txt @@ -0,0 +1 @@ +fix(metrics)!: drop k8s.node.name attribute \ No newline at end of file diff --git a/deploy/helm/sumologic/conf/metrics/otelcol/processors.yaml b/deploy/helm/sumologic/conf/metrics/otelcol/processors.yaml index 87e9eb1dc1..ca12ae4c17 100644 --- a/deploy/helm/sumologic/conf/metrics/otelcol/processors.yaml +++ b/deploy/helm/sumologic/conf/metrics/otelcol/processors.yaml @@ -93,6 +93,11 @@ resource: key: k8s.container.name # add container in OpenTelemetry convention to unify configuration for Source processor - action: delete key: container # remove container to avoid duplication when attribute translation is enabled + - action: upsert + from_attribute: node + key: k8s.node.name # add container in OpenTelemetry convention to unify configuration for Source processor + - action: delete + key: node # remove container to avoid duplication when attribute translation is enabled - action: upsert from_attribute: service key: prometheus_service diff --git a/docs/v4-migration-doc.md b/docs/v4-migration-doc.md index b8b1718a3e..f03c7854b5 100644 --- a/docs/v4-migration-doc.md +++ b/docs/v4-migration-doc.md @@ -195,6 +195,10 @@ require additional action. - node_filesystem_avail_bytes - node_filesystem_size_bytes +- Drop `k8s.node.name` attribute from metrics + + The `node` attribute exists and has the same value, so this is superfluous. + - Truncating full name to 22 characters Some Kubernetes objects, for example statefulsets, have a tight (63 characters) limit for their names. Because of that, we truncate the diff --git a/tests/helm/testdata/goldenfile/metadata_metrics_otc/additional_endpoints.output.yaml b/tests/helm/testdata/goldenfile/metadata_metrics_otc/additional_endpoints.output.yaml index 15d313297a..a5d378640e 100644 --- a/tests/helm/testdata/goldenfile/metadata_metrics_otc/additional_endpoints.output.yaml +++ b/tests/helm/testdata/goldenfile/metadata_metrics_otc/additional_endpoints.output.yaml @@ -168,6 +168,11 @@ data: 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 diff --git a/tests/helm/testdata/goldenfile/metadata_metrics_otc/basic.output.yaml b/tests/helm/testdata/goldenfile/metadata_metrics_otc/basic.output.yaml index bb8f18a3cc..b620906d3e 100644 --- a/tests/helm/testdata/goldenfile/metadata_metrics_otc/basic.output.yaml +++ b/tests/helm/testdata/goldenfile/metadata_metrics_otc/basic.output.yaml @@ -168,6 +168,11 @@ data: 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 diff --git a/tests/helm/testdata/goldenfile/metadata_metrics_otc/custom.output.yaml b/tests/helm/testdata/goldenfile/metadata_metrics_otc/custom.output.yaml index cf92329bca..731f50690f 100644 --- a/tests/helm/testdata/goldenfile/metadata_metrics_otc/custom.output.yaml +++ b/tests/helm/testdata/goldenfile/metadata_metrics_otc/custom.output.yaml @@ -98,6 +98,11 @@ data: 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 diff --git a/tests/helm/testdata/goldenfile/metadata_metrics_otc/filtered_app_metrics.output.yaml b/tests/helm/testdata/goldenfile/metadata_metrics_otc/filtered_app_metrics.output.yaml index 245e365ad7..02bc98530b 100644 --- a/tests/helm/testdata/goldenfile/metadata_metrics_otc/filtered_app_metrics.output.yaml +++ b/tests/helm/testdata/goldenfile/metadata_metrics_otc/filtered_app_metrics.output.yaml @@ -192,6 +192,11 @@ data: 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 diff --git a/tests/integration/features.go b/tests/integration/features.go index 3badd67450..c37ec70d7e 100644 --- a/tests/integration/features.go +++ b/tests/integration/features.go @@ -122,7 +122,6 @@ func GetMetricsFeature(expectedMetrics []string, metricsCollector MetricsCollect expectedLabels = addCollectorSpecificMetricLabels(expectedLabels, releaseName, namespace, metricsCollector) // drop some unnecessary labels delete(expectedLabels, "prometheus_service") - delete(expectedLabels, "k8s.node.name") return stepfuncs.WaitUntilExpectedMetricLabelsPresent(metricFilters, expectedLabels, waitDuration, tickDuration)(ctx, t, envConf) }, @@ -169,7 +168,6 @@ func GetTelegrafMetricsFeature(expectedMetrics []string, metricsCollector Metric expectedLabels = addCollectorSpecificMetricLabels(expectedLabels, releaseName, namespace, metricsCollector) // drop some unnecessary labels - delete(expectedLabels, "k8s.node.name") delete(expectedLabels, "prometheus_service") return stepfuncs.WaitUntilExpectedMetricLabelsPresent(metricFilters, expectedLabels, waitDuration, tickDuration)(ctx, t, envConf) @@ -187,7 +185,6 @@ func addCollectorSpecificMetricLabels(labels receivermock.Labels, releaseName st } prometheusLabels := receivermock.Labels{ "_collector": "kubernetes", - "k8s.node.name": internal.NodeNameRegex, // TODO: Remove this during the migration to v4 "instance": internal.IpWithPortRegex, "prometheus_replica": fmt.Sprintf("prometheus-%s-.*-0", releaseName), "prometheus": fmt.Sprintf("%s/%s-.*-prometheus", serviceMonitorNamespace, releaseName),