Skip to content

Commit

Permalink
refactor ReservedNamespace to OtelAnnotationNamespace
Browse files Browse the repository at this point in the history
Signed-off-by: Horiodino <[email protected]>
  • Loading branch information
Horiodino committed Jun 7, 2024
1 parent 137aa57 commit 5273b69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions pkg/constants/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions pkg/instrumentation/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 5273b69

Please sign in to comment.