From e2c73d0e21af02f2a87dd5f98429bf8fa6a36e73 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 15 Nov 2021 11:28:15 -0800 Subject: [PATCH] Extract `container.image.tag` attribute from `container.image.name` Update k8sClusterReceiver component to export `container.image.tag` attribute from `container.image.name` according to OpenTelemetry semantic conventions https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/resource/semantic_conventions/container.md This can be removed once this issue https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/6314 is resolved --- CHANGELOG.md | 4 ++++ .../config/_otel-k8s-cluster-receiver-config.tpl | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dfc0f97c3..b9a9ef6d23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Field name compatibility for SCK (#258) +### Changed + +- Extract `container.image.tag` attribute from `container.image.name` (#285) + ### Removed - Busybox image dependency (#275) diff --git a/helm-charts/splunk-otel-collector/templates/config/_otel-k8s-cluster-receiver-config.tpl b/helm-charts/splunk-otel-collector/templates/config/_otel-k8s-cluster-receiver-config.tpl index 722a35b6b6..eafb158170 100644 --- a/helm-charts/splunk-otel-collector/templates/config/_otel-k8s-cluster-receiver-config.tpl +++ b/helm-charts/splunk-otel-collector/templates/config/_otel-k8s-cluster-receiver-config.tpl @@ -94,6 +94,21 @@ processors: key: {{ .name }} value: {{ .value }} {{- end }} + # Extract "container.image.tag" attribute from "container.image.name" here until k8scluster + # receiver does it natively. + - key: container.image.name + pattern: ^(?P[^\:]+)(?:\:(?P.*))? + action: extract + - key: container.image.name + from_attribute: container_image_name + action: upsert + - key: container_image_name + action: delete + - key: container.image.tag + from_attribute: container_image_tag + action: upsert + - key: container_image_tag + action: delete exporters: {{- if eq (include "splunk-otel-collector.o11yMetricsEnabled" $) "true" }}