From eb6e5afca502bfb9c8359cd0ca4ad0099f16d85f Mon Sep 17 00:00:00 2001 From: Andrew Lozoya Date: Wed, 3 Apr 2024 02:18:08 -0500 Subject: [PATCH] New Relic Labels --- pkg/constants/env.go | 1 + pkg/instrumentation/sdk.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pkg/constants/env.go b/pkg/constants/env.go index bbd67ef..d2d9b0e 100644 --- a/pkg/constants/env.go +++ b/pkg/constants/env.go @@ -30,4 +30,5 @@ const ( EnvNewRelicAppName = "NEW_RELIC_APP_NAME" EnvNewRelicLicenseKey = "NEW_RELIC_LICENSE_KEY" + EnvNewRelicLabels = "NEW_RELIC_LABELS" ) diff --git a/pkg/instrumentation/sdk.go b/pkg/instrumentation/sdk.go index fa82af7..6f14032 100644 --- a/pkg/instrumentation/sdk.go +++ b/pkg/instrumentation/sdk.go @@ -323,6 +323,13 @@ func (i *sdkInjector) injectNewrelicConfig(ctx context.Context, newrelic v1alpha }, }) } + idx = getIndexOfEnv(container.Env, constants.EnvNewRelicLabels) + if idx == -1 { + container.Env = append(container.Env, corev1.EnvVar{ + Name: "NEW_RELIC_LABELS", + Value: "operator:auto-injection", + }) + } return pod }