diff --git a/otel-integration/CHANGELOG.md b/otel-integration/CHANGELOG.md index 71e4aa2f..0ba08cf9 100644 --- a/otel-integration/CHANGELOG.md +++ b/otel-integration/CHANGELOG.md @@ -2,6 +2,9 @@ ## OpenTelemtry-Integration +### v0.0.76 / 2024-06-03 +- [FEAT] Add Kubernetes metadata to otel collector metrics + ### v0.0.75 / 2024-06-03 - [FEAT] Add status_code to spanmetrics preset diff --git a/otel-integration/k8s-helm/Chart.yaml b/otel-integration/k8s-helm/Chart.yaml index f3f9ef69..d00fd9d7 100644 --- a/otel-integration/k8s-helm/Chart.yaml +++ b/otel-integration/k8s-helm/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: otel-integration description: OpenTelemetry Integration -version: 0.0.75 +version: 0.0.76 keywords: - OpenTelemetry Collector - OpenTelemetry Agent diff --git a/otel-integration/k8s-helm/e2e-test/expected_test.go b/otel-integration/k8s-helm/e2e-test/expected_test.go index f1ee4329..c7c7d5db 100644 --- a/otel-integration/k8s-helm/e2e-test/expected_test.go +++ b/otel-integration/k8s-helm/e2e-test/expected_test.go @@ -54,6 +54,11 @@ var expectedResourceAttributesPrometheusreceiver = map[string]string{ "k8s.node.name": "otel-integration-agent-e2e-control-plane", "host.name": "otel-integration-agent-e2e-control-plane", "host.id": "", + "k8s.pod.ip": "", + "k8s.pod.name": "", + "k8s.deployment.name": "", + "k8s.namespace.name": "", + "k8s.daemonset.name": "", "os.type": "linux", } diff --git a/otel-integration/k8s-helm/e2e-test/main_test.go b/otel-integration/k8s-helm/e2e-test/main_test.go index 786e7c54..7cd1f600 100644 --- a/otel-integration/k8s-helm/e2e-test/main_test.go +++ b/otel-integration/k8s-helm/e2e-test/main_test.go @@ -134,7 +134,7 @@ func checkResourceAttributes(t *testing.T, attributes pcommon.Map, scopeName str attributes.Range(func(k string, v pcommon.Value) bool { val, ok := compareMap[k] - require.True(t, ok, "unexpected attribute %v", k) + require.True(t, ok, "unexpected attribute %v - scopeName: %s", k, scopeName) if val != "" { require.Equal(t, val, v.AsString(), "unexpected value for attribute %v", k) } diff --git a/otel-integration/k8s-helm/values.yaml b/otel-integration/k8s-helm/values.yaml index 2fa43089..503258bd 100644 --- a/otel-integration/k8s-helm/values.yaml +++ b/otel-integration/k8s-helm/values.yaml @@ -5,7 +5,7 @@ global: defaultSubsystemName: "integration" logLevel: "warn" collectionInterval: "30s" - version: "0.0.75" + version: "0.0.76" extensions: kubernetesDashboard: @@ -206,6 +206,12 @@ opentelemetry-agent: detectors: ["gcp", "ec2"] timeout: 2s override: true + transform/prometheus: + error_mode: ignore + metric_statements: + - context: resource + statements: + - set(attributes["k8s.pod.ip"], attributes["net.host.name"]) where attributes["service.name"] == "opentelemetry-collector" k8sattributes: filter: node_from_env_var: KUBE_NODE_NAME @@ -270,6 +276,7 @@ opentelemetry-agent: exporters: - coralogix processors: + - transform/prometheus - k8sattributes - resourcedetection/env - resourcedetection/region @@ -444,6 +451,12 @@ opentelemetry-cluster-collector: - "k8s.job.name" - "k8s.pod.name" - "k8s.node.name" + transform/prometheus: + error_mode: ignore + metric_statements: + - context: resource + statements: + - set(attributes["k8s.pod.ip"], attributes["net.host.name"]) where attributes["service.name"] == "opentelemetry-infrastructure-collector" resource/kube-events: attributes: - key: service.name @@ -581,6 +594,7 @@ opentelemetry-cluster-collector: exporters: - coralogix processors: + - transform/prometheus - k8sattributes - metricstransform/k8s-dashboard - transform/k8s-dashboard