From 5273b69fc875a63eb915826dd8dc586a28c0e60e Mon Sep 17 00:00:00 2001 From: Horiodino Date: Fri, 7 Jun 2024 15:38:40 +0530 Subject: [PATCH] refactor ReservedNamespace to OtelAnnotationNamespace Signed-off-by: Horiodino --- pkg/constants/env.go | 12 ++++++------ pkg/instrumentation/sdk.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/constants/env.go b/pkg/constants/env.go index 244a417667..45d0a82982 100644 --- a/pkg/constants/env.go +++ b/pkg/constants/env.go @@ -31,12 +31,12 @@ const ( AnnotationDefaultAutoInstrumentationApacheHttpd = InstrumentationPrefix + "default-auto-instrumentation-apache-httpd-image" AnnotationDefaultAutoInstrumentationNginx = InstrumentationPrefix + "default-auto-instrumentation-nginx-image" - EnvPodName = "OTEL_RESOURCE_ATTRIBUTES_POD_NAME" - EnvPodUID = "OTEL_RESOURCE_ATTRIBUTES_POD_UID" - EnvPodIP = "OTEL_POD_IP" - EnvNodeName = "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME" - EnvNodeIP = "OTEL_NODE_IP" - ReservedNamespace = "resource.opentelemetry.io/" + EnvPodName = "OTEL_RESOURCE_ATTRIBUTES_POD_NAME" + EnvPodUID = "OTEL_RESOURCE_ATTRIBUTES_POD_UID" + EnvPodIP = "OTEL_POD_IP" + EnvNodeName = "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME" + EnvNodeIP = "OTEL_NODE_IP" + OtelAnnotationNamespace = "resource.opentelemetry.io/" FlagCRMetrics = "enable-cr-metrics" FlagApacheHttpd = "enable-apache-httpd-instrumentation" diff --git a/pkg/instrumentation/sdk.go b/pkg/instrumentation/sdk.go index ca81adf0e0..ed6f70663d 100644 --- a/pkg/instrumentation/sdk.go +++ b/pkg/instrumentation/sdk.go @@ -481,8 +481,8 @@ func (i *sdkInjector) createResourceMap(ctx context.Context, otelinst v1alpha1.I } for k, v := range pod.GetAnnotations() { - if strings.HasPrefix(k, constants.ReservedNamespace) { - key := strings.TrimSpace(strings.TrimPrefix(k, constants.ReservedNamespace)) + if strings.HasPrefix(k, constants.OtelAnnotationNamespace) { + key := strings.TrimSpace(strings.TrimPrefix(k, constants.OtelAnnotationNamespace)) if _, ok := res[key]; !ok { res[key] = v }