Skip to content

Commit

Permalink
fix(metrics)!: drop k8s.node.name attribute
Browse files Browse the repository at this point in the history
Use the `node` attribute instead. This was only part of the metrics
metadata by mistake.
  • Loading branch information
swiatekm committed Sep 21, 2023
1 parent 2051602 commit c700706
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions .changelog/3295.fixed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix(metrics)!: drop k8s.node.name attribute
5 changes: 5 additions & 0 deletions deploy/helm/sumologic/conf/metrics/otelcol/processors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions docs/v4-migration-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down Expand Up @@ -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)
Expand All @@ -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),
Expand Down

0 comments on commit c700706

Please sign in to comment.