From f4e8b0be879410779dd7110b3d9d2724ff24cc7b Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Wed, 10 Apr 2024 11:25:40 +0200 Subject: [PATCH 01/11] NodeJS instrumentation featuregates into cli Signed-off-by: Yuri Sa --- .../change-instrumentation-feature-gates.yaml | 16 ++++++++++++++++ internal/config/main.go | 7 +++++++ internal/config/options.go | 6 ++++++ main.go | 4 ++++ pkg/constants/env.go | 1 + pkg/instrumentation/podmutator.go | 2 +- pkg/instrumentation/upgrade/upgrade.go | 12 +++++++++--- pkg/instrumentation/upgrade/upgrade_test.go | 2 ++ 8 files changed, 46 insertions(+), 4 deletions(-) create mode 100755 .chloggen/change-instrumentation-feature-gates.yaml diff --git a/.chloggen/change-instrumentation-feature-gates.yaml b/.chloggen/change-instrumentation-feature-gates.yaml new file mode 100755 index 0000000000..0f15512467 --- /dev/null +++ b/.chloggen/change-instrumentation-feature-gates.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: 'breaking' + +# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) +component: 'operator' + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: change nodejs instrumentation feature gate operator.autoinstrumentation.nodejs into command line flag --enable-nodejs-instrumentation + +# One or more tracking issues related to the change +issues: [2674] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/internal/config/main.go b/internal/config/main.go index aa64953463..b8943ff02d 100644 --- a/internal/config/main.go +++ b/internal/config/main.go @@ -49,6 +49,7 @@ type Config struct { enableDotNetInstrumentation bool enableNginxInstrumentation bool enablePythonInstrumentation bool + enableNodeJSInstrumentation bool autoInstrumentationDotNetImage string autoInstrumentationGoImage string autoInstrumentationApacheHttpdImage string @@ -89,6 +90,7 @@ func New(opts ...Option) Config { enableDotNetInstrumentation: o.enableDotNetInstrumentation, enableNginxInstrumentation: o.enableNginxInstrumentation, enablePythonInstrumentation: o.enablePythonInstrumentation, + enableNodeJSInstrumentation: o.enableNodeJSInstrumentation, targetAllocatorImage: o.targetAllocatorImage, operatorOpAMPBridgeImage: o.operatorOpAMPBridgeImage, targetAllocatorConfigMapEntry: o.targetAllocatorConfigMapEntry, @@ -156,6 +158,11 @@ func (c *Config) EnablePythonAutoInstrumentation() bool { return c.enablePythonInstrumentation } +// EnableNodeJSAutoInstrumentation is true when the operator supports dotnet auto instrumentation. +func (c *Config) EnableNodeJSAutoInstrumentation() bool { + return c.enableNodeJSInstrumentation +} + // CollectorConfigMapEntry represents the configuration file name for the collector. Immutable. func (c *Config) CollectorConfigMapEntry() string { return c.collectorConfigMapEntry diff --git a/internal/config/options.go b/internal/config/options.go index 6969081699..6e6165ed4f 100644 --- a/internal/config/options.go +++ b/internal/config/options.go @@ -48,6 +48,7 @@ type options struct { enableDotNetInstrumentation bool enableNginxInstrumentation bool enablePythonInstrumentation bool + enableNodeJSInstrumentation bool targetAllocatorConfigMapEntry string operatorOpAMPBridgeConfigMapEntry string targetAllocatorImage string @@ -113,6 +114,11 @@ func WithEnablePythonInstrumentation(s bool) Option { o.enablePythonInstrumentation = s } } +func WithEnableNodeJSInstrumentation(s bool) Option { + return func(o *options) { + o.enableNodeJSInstrumentation = s + } +} func WithTargetAllocatorConfigMapEntry(s string) Option { return func(o *options) { o.targetAllocatorConfigMapEntry = s diff --git a/main.go b/main.go index fca734ce3b..7601c0fff3 100644 --- a/main.go +++ b/main.go @@ -112,6 +112,7 @@ func main() { enableDotNetInstrumentation bool enablePythonInstrumentation bool enableNginxInstrumentation bool + enableNodeJSInstrumentation bool collectorImage string targetAllocatorImage string operatorOpAMPBridgeImage string @@ -140,6 +141,7 @@ func main() { pflag.BoolVar(&enableDotNetInstrumentation, constants.FlagDotNet, true, "Controls whether the operator supports dotnet auto-instrumentation") pflag.BoolVar(&enablePythonInstrumentation, constants.FlagPython, true, "Controls whether the operator supports python auto-instrumentation") pflag.BoolVar(&enableNginxInstrumentation, constants.FlagNginx, false, "Controls whether the operator supports nginx auto-instrumentation") + pflag.BoolVar(&enableNodeJSInstrumentation, constants.FlagNodeJS, false, "Controls whether the operator supports nodejs auto-instrumentation") stringFlagOrEnv(&collectorImage, "collector-image", "RELATED_IMAGE_COLLECTOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.") stringFlagOrEnv(&targetAllocatorImage, "target-allocator-image", "RELATED_IMAGE_TARGET_ALLOCATOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/target-allocator:%s", v.TargetAllocator), "The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource.") stringFlagOrEnv(&operatorOpAMPBridgeImage, "operator-opamp-bridge-image", "RELATED_IMAGE_OPERATOR_OPAMP_BRIDGE", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/operator-opamp-bridge:%s", v.OperatorOpAMPBridge), "The default OpenTelemetry Operator OpAMP Bridge image. This image is used when no image is specified in the CustomResource.") @@ -184,6 +186,7 @@ func main() { "enable-dotnet-instrumentation", enableDotNetInstrumentation, "enable-python-instrumentation", enablePythonInstrumentation, "enable-nginx-instrumentation", enableNginxInstrumentation, + "enable-nodejs-instrumentation", enableNodeJSInstrumentation, ) restConfig := ctrl.GetConfigOrDie() @@ -205,6 +208,7 @@ func main() { config.WithEnableDotNetInstrumentation(enableDotNetInstrumentation), config.WithEnableNginxInstrumentation(enableNginxInstrumentation), config.WithEnablePythonInstrumentation(enablePythonInstrumentation), + config.WithEnableNodeJSInstrumentation(enableNodeJSInstrumentation), config.WithTargetAllocatorImage(targetAllocatorImage), config.WithOperatorOpAMPBridgeImage(operatorOpAMPBridgeImage), config.WithAutoInstrumentationJavaImage(autoInstrumentationJava), diff --git a/pkg/constants/env.go b/pkg/constants/env.go index d5274ade7a..599e0355e7 100644 --- a/pkg/constants/env.go +++ b/pkg/constants/env.go @@ -41,4 +41,5 @@ const ( FlagDotNet = "enable-dotnet-instrumentation" FlagPython = "enable-python-instrumentation" FlagNginx = "enable-nginx-instrumentation" + FlagNodeJS = "enable-nodejs-instrumentation" ) diff --git a/pkg/instrumentation/podmutator.go b/pkg/instrumentation/podmutator.go index 8cdd9cfa81..0b1bc94972 100644 --- a/pkg/instrumentation/podmutator.go +++ b/pkg/instrumentation/podmutator.go @@ -241,7 +241,7 @@ func (pm *instPodMutator) Mutate(ctx context.Context, ns corev1.Namespace, pod c logger.Error(err, "failed to select an OpenTelemetry Instrumentation instance for this pod") return pod, err } - if featuregate.EnableNodeJSAutoInstrumentationSupport.IsEnabled() || inst == nil { + if pm.config.EnableNodeJSAutoInstrumentation() || inst == nil { insts.NodeJS.Instrumentation = inst } else { logger.Error(nil, "support for NodeJS auto instrumentation is not enabled") diff --git a/pkg/instrumentation/upgrade/upgrade.go b/pkg/instrumentation/upgrade/upgrade.go index 3d7510b8cb..e312536a20 100644 --- a/pkg/instrumentation/upgrade/upgrade.go +++ b/pkg/instrumentation/upgrade/upgrade.go @@ -32,9 +32,8 @@ import ( var ( defaultAnnotationToGate = map[string]*featuregate2.Gate{ - constants.AnnotationDefaultAutoInstrumentationJava: featuregate.EnableJavaAutoInstrumentationSupport, - constants.AnnotationDefaultAutoInstrumentationNodeJS: featuregate.EnableNodeJSAutoInstrumentationSupport, - constants.AnnotationDefaultAutoInstrumentationGo: featuregate.EnableGoAutoInstrumentationSupport, + constants.AnnotationDefaultAutoInstrumentationJava: featuregate.EnableJavaAutoInstrumentationSupport, + constants.AnnotationDefaultAutoInstrumentationGo: featuregate.EnableGoAutoInstrumentationSupport, } ) @@ -63,6 +62,7 @@ func NewInstrumentationUpgrade(client client.Client, logger logr.Logger, recorde constants.AnnotationDefaultAutoInstrumentationDotNet: {constants.FlagDotNet, cfg.EnableDotNetAutoInstrumentation()}, constants.AnnotationDefaultAutoInstrumentationNginx: {constants.FlagNginx, cfg.EnableNginxAutoInstrumentation()}, constants.AnnotationDefaultAutoInstrumentationPython: {constants.FlagPython, cfg.EnablePythonAutoInstrumentation()}, + constants.AnnotationDefaultAutoInstrumentationNodeJS: {constants.FlagNodeJS, cfg.EnableNodeJSAutoInstrumentation()}, } return &InstrumentationUpgrade{ @@ -142,7 +142,13 @@ func (u *InstrumentationUpgrade) upgrade(_ context.Context, inst v1alpha1.Instru upgraded.Spec.Python.Image = u.DefaultAutoInstPython upgraded.Annotations[annotation] = u.DefaultAutoInstPython } + case constants.AnnotationDefaultAutoInstrumentationNodeJS: + if inst.Spec.NodeJS.Image == autoInst { + upgraded.Spec.NodeJS.Image = u.DefaultAutoInstNodeJS + upgraded.Annotations[annotation] = u.DefaultAutoInstNodeJS + } } + } else { u.Logger.V(4).Info("autoinstrumentation not enabled for this language", "flag", instCfg.id) } diff --git a/pkg/instrumentation/upgrade/upgrade_test.go b/pkg/instrumentation/upgrade/upgrade_test.go index 900360b631..59351ee999 100644 --- a/pkg/instrumentation/upgrade/upgrade_test.go +++ b/pkg/instrumentation/upgrade/upgrade_test.go @@ -76,6 +76,7 @@ func TestUpgrade(t *testing.T) { config.WithEnableDotNetInstrumentation(true), config.WithEnableNginxInstrumentation(true), config.WithEnablePythonInstrumentation(true), + config.WithEnableNodeJSInstrumentation(true), ), ).Default(context.Background(), inst) assert.Nil(t, err) @@ -101,6 +102,7 @@ func TestUpgrade(t *testing.T) { config.WithEnableDotNetInstrumentation(true), config.WithEnableNginxInstrumentation(true), config.WithEnablePythonInstrumentation(true), + config.WithEnableNodeJSInstrumentation(true), ) up := NewInstrumentationUpgrade(k8sClient, ctrl.Log.WithName("instrumentation-upgrade"), &record.FakeRecorder{}, cfg) From ba8654bee60b6d74445cf3c22cf6b0cd5d018df1 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 26 Apr 2024 12:16:22 +0200 Subject: [PATCH 02/11] Added complement to featuregate Signed-off-by: Yuri Sa --- .chloggen/change-instrumentation-feature-gates.yaml | 2 +- pkg/featuregate/featuregate.go | 6 ------ pkg/instrumentation/podmutator_test.go | 12 +++++------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.chloggen/change-instrumentation-feature-gates.yaml b/.chloggen/change-instrumentation-feature-gates.yaml index 0f15512467..50e93eace9 100755 --- a/.chloggen/change-instrumentation-feature-gates.yaml +++ b/.chloggen/change-instrumentation-feature-gates.yaml @@ -5,7 +5,7 @@ change_type: 'breaking' component: 'operator' # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: change nodejs instrumentation feature gate operator.autoinstrumentation.nodejs into command line flag --enable-nodejs-instrumentation +note: remove featuregate `operator.autoinstrumentation.nodejs`. Use command line flag `--enable-nodejs-instrumentation` instead # One or more tracking issues related to the change issues: [2674] diff --git a/pkg/featuregate/featuregate.go b/pkg/featuregate/featuregate.go index a20d589b35..ef4d67ce48 100644 --- a/pkg/featuregate/featuregate.go +++ b/pkg/featuregate/featuregate.go @@ -31,12 +31,6 @@ var ( featuregate.WithRegisterDescription("controls whether the operator supports Java auto-instrumentation"), featuregate.WithRegisterFromVersion("v0.76.1"), ) - EnableNodeJSAutoInstrumentationSupport = featuregate.GlobalRegistry().MustRegister( - "operator.autoinstrumentation.nodejs", - featuregate.StageBeta, - featuregate.WithRegisterDescription("controls whether the operator supports NodeJS auto-instrumentation"), - featuregate.WithRegisterFromVersion("v0.76.1"), - ) EnableGoAutoInstrumentationSupport = featuregate.GlobalRegistry().MustRegister( "operator.autoinstrumentation.go", featuregate.StageAlpha, diff --git a/pkg/instrumentation/podmutator_test.go b/pkg/instrumentation/podmutator_test.go index c457145737..d441ab671f 100644 --- a/pkg/instrumentation/podmutator_test.go +++ b/pkg/instrumentation/podmutator_test.go @@ -819,6 +819,7 @@ func TestMutatePod(t *testing.T) { }, }, }, + config: config.New(config.WithEnableNodeJSInstrumentation(true)), }, { name: "nodejs injection multiple containers, true", @@ -1090,6 +1091,7 @@ func TestMutatePod(t *testing.T) { }, }, }, + config: config.New(config.WithEnableNodeJSInstrumentation(true)), }, { name: "nodejs injection feature gate disabled", @@ -1172,13 +1174,6 @@ func TestMutatePod(t *testing.T) { }, }, }, - setFeatureGates: func(t *testing.T) { - originalVal := featuregate.EnableNodeJSAutoInstrumentationSupport.IsEnabled() - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNodeJSAutoInstrumentationSupport.ID(), false)) - t.Cleanup(func() { - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNodeJSAutoInstrumentationSupport.ID(), originalVal)) - }) - }, }, { name: "python injection, true", @@ -4213,6 +4208,7 @@ func TestMutatePod(t *testing.T) { config.WithEnableMultiInstrumentation(true), config.WithEnablePythonInstrumentation(true), config.WithEnableDotNetInstrumentation(true), + config.WithEnableNodeJSInstrumentation(true), ), }, { @@ -5003,6 +4999,7 @@ func TestMutatePod(t *testing.T) { config.WithEnableMultiInstrumentation(true), config.WithEnableDotNetInstrumentation(true), config.WithEnablePythonInstrumentation(true), + config.WithEnableNodeJSInstrumentation(true), ), }, { @@ -5602,6 +5599,7 @@ func TestMutatePod(t *testing.T) { config: config.New( config.WithEnableMultiInstrumentation(true), config.WithEnableDotNetInstrumentation(false), + config.WithEnableNodeJSInstrumentation(false), ), }, } From d0fe50de7d06794f8972d7ecc84f7376147e3e2e Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 26 Apr 2024 12:39:25 +0200 Subject: [PATCH 03/11] Fixed Linters Signed-off-by: Yuri Sa --- pkg/instrumentation/upgrade/upgrade.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/instrumentation/upgrade/upgrade.go b/pkg/instrumentation/upgrade/upgrade.go index 014c679141..733082d1cc 100644 --- a/pkg/instrumentation/upgrade/upgrade.go +++ b/pkg/instrumentation/upgrade/upgrade.go @@ -32,7 +32,7 @@ import ( var ( defaultAnnotationToGate = map[string]*featuregate2.Gate{ - constants.AnnotationDefaultAutoInstrumentationGo: featuregate.EnableGoAutoInstrumentationSupport, + constants.AnnotationDefaultAutoInstrumentationGo: featuregate.EnableGoAutoInstrumentationSupport, } ) From 13baf6ea1d04f1f9737cfde04da31b6edc9bf0f6 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 26 Apr 2024 13:04:54 +0200 Subject: [PATCH 04/11] Fixed Linters Signed-off-by: Yuri Sa --- pkg/instrumentation/podmutator_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/instrumentation/podmutator_test.go b/pkg/instrumentation/podmutator_test.go index 861612702a..ddeffae497 100644 --- a/pkg/instrumentation/podmutator_test.go +++ b/pkg/instrumentation/podmutator_test.go @@ -5150,7 +5150,7 @@ func TestMutatePod(t *testing.T) { }, }, }, - config: config.New(config.WithEnableMultiInstrumentation(false)), + config: config.New(config.WithEnableMultiInstrumentation(false), config.WithEnableJavaInstrumentation(false)), }, { name: "multi instrumentation feature gate enabled, multiple instrumentation annotations set, no containers", @@ -5294,7 +5294,7 @@ func TestMutatePod(t *testing.T) { }, }, }, - config: config.New(config.WithEnableMultiInstrumentation(true)), + config: config.New(config.WithEnableMultiInstrumentation(true), config.WithEnableJavaInstrumentation(false)), }, { name: "multi instrumentation feature gate enabled, single instrumentation annotation set, no containers", From b80b96745efa27a69d46849a4e1a4e4c7d24079f Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 26 Apr 2024 13:39:03 +0200 Subject: [PATCH 05/11] Added e2e parameters Signed-off-by: Yuri Sa --- .github/workflows/e2e.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 7ee5c89d79..a81d477421 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -34,8 +34,10 @@ jobs: - e2e-multi-instrumentation - e2e-metadata-filters include: + - group: e2e-instrumentation + setup: "add-operator-arg OPERATOR_ARG=-'--enable-nodejs-instrumentation' prepare-e2e" - group: e2e-multi-instrumentation - setup: "add-operator-arg OPERATOR_ARG=--enable-multi-instrumentation prepare-e2e" + setup: "add-operator-arg OPERATOR_ARG=-'--enable-multi-instrumentation --enable-nodejs-instrumentation' prepare-e2e" - group: e2e-metadata-filters setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=*filter.out --labels=*filter.out' prepare-e2e" From 4aa1f54517aa3ed4503172c1892b5904b7da7949 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Mon, 29 Apr 2024 14:24:45 +0200 Subject: [PATCH 06/11] Fixed e2e test Signed-off-by: Yuri Sa --- .github/workflows/e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index ca9be8533a..e80bbdb966 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -37,7 +37,7 @@ jobs: - group: e2e-instrumentation setup: "add-operator-arg OPERATOR_ARG=-'--enable-go-instrumentation --enable-nodejs-instrumentation' prepare-e2e" - group: e2e-multi-instrumentation - setup: "add-operator-arg OPERATOR_ARG=-'--enable-multi-instrumentation --enable-nodejs-instrumentation' prepare-e2e" + setup: "add-operator-arg OPERATOR_ARG=-'--enable-multi-instrumentation' prepare-e2e" - group: e2e-metadata-filters setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=*filter.out --labels=*filter.out' prepare-e2e" From 2400b7935f5d7054d31ee8fe9c0ae6be6470f7cc Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Mon, 29 Apr 2024 14:34:27 +0200 Subject: [PATCH 07/11] Fixed e2e test Signed-off-by: Yuri Sa --- .github/workflows/e2e.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index e80bbdb966..5d0462bebf 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -35,9 +35,9 @@ jobs: - e2e-metadata-filters include: - group: e2e-instrumentation - setup: "add-operator-arg OPERATOR_ARG=-'--enable-go-instrumentation --enable-nodejs-instrumentation' prepare-e2e" + setup: "add-operator-arg OPERATOR_ARG='--enable-go-instrumentation --enable-nodejs-instrumentation' prepare-e2e" - group: e2e-multi-instrumentation - setup: "add-operator-arg OPERATOR_ARG=-'--enable-multi-instrumentation' prepare-e2e" + setup: "add-operator-arg OPERATOR_ARG='--enable-multi-instrumentation' prepare-e2e" - group: e2e-metadata-filters setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=*filter.out --labels=*filter.out' prepare-e2e" From f5a10bc992332523ae23c6744a355c82ffe79df3 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Mon, 29 Apr 2024 14:55:36 +0200 Subject: [PATCH 08/11] Fixed e2e test Signed-off-by: Yuri Sa --- .github/workflows/e2e.yaml | 4 ++-- Makefile | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 5d0462bebf..d8bf4d629a 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -35,9 +35,9 @@ jobs: - e2e-metadata-filters include: - group: e2e-instrumentation - setup: "add-operator-arg OPERATOR_ARG='--enable-go-instrumentation --enable-nodejs-instrumentation' prepare-e2e" + setup: "add-instrumentation-params prepare-e2e" - group: e2e-multi-instrumentation - setup: "add-operator-arg OPERATOR_ARG='--enable-multi-instrumentation' prepare-e2e" + setup: "add-multi-instrumentation-params prepare-e2e" - group: e2e-metadata-filters setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=*filter.out --labels=*filter.out' prepare-e2e" diff --git a/Makefile b/Makefile index e55cb145be..e2dbb0e272 100644 --- a/Makefile +++ b/Makefile @@ -145,6 +145,14 @@ add-operator-arg: manifests kustomize add-image-targetallocator: @$(MAKE) add-operator-arg OPERATOR_ARG=--target-allocator-image=$(TARGETALLOCATOR_IMG) +.PHONY: add-instrumentation-params +add-instrumentation-params: + @$(MAKE) add-operator-arg OPERATOR_ARG='--enable-go-instrumentation=true --enable-nodejs-instrumentation=true' + +.PHONY: add-multi-instrumentation-params +add-multi-instrumentation-params: + @$(MAKE) add-operator-arg OPERATOR_ARG='--enable-multi-instrumentation=true --enable-nodejs-instrumentation=true' + .PHONY: add-image-opampbridge add-image-opampbridge: @$(MAKE) add-operator-arg OPERATOR_ARG=--operator-opamp-bridge-image=$(OPERATOROPAMPBRIDGE_IMG) From 9cfc96ae6be32bc5ee2d723ed5a6c4e7e248feaf Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Mon, 29 Apr 2024 15:12:08 +0200 Subject: [PATCH 09/11] Fixed e2e test Signed-off-by: Yuri Sa --- Makefile | 4 ++-- main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e2dbb0e272..d169d3c38b 100644 --- a/Makefile +++ b/Makefile @@ -147,11 +147,11 @@ add-image-targetallocator: .PHONY: add-instrumentation-params add-instrumentation-params: - @$(MAKE) add-operator-arg OPERATOR_ARG='--enable-go-instrumentation=true --enable-nodejs-instrumentation=true' + @$(MAKE) add-operator-arg OPERATOR_ARG=--enable-go-instrumentation=true .PHONY: add-multi-instrumentation-params add-multi-instrumentation-params: - @$(MAKE) add-operator-arg OPERATOR_ARG='--enable-multi-instrumentation=true --enable-nodejs-instrumentation=true' + @$(MAKE) add-operator-arg OPERATOR_ARG=--enable-multi-instrumentation .PHONY: add-image-opampbridge add-image-opampbridge: diff --git a/main.go b/main.go index e5c24195e4..fb12b5eccf 100644 --- a/main.go +++ b/main.go @@ -146,7 +146,7 @@ func main() { pflag.BoolVar(&enableGoInstrumentation, constants.FlagGo, false, "Controls whether the operator supports Go auto-instrumentation") pflag.BoolVar(&enablePythonInstrumentation, constants.FlagPython, true, "Controls whether the operator supports python auto-instrumentation") pflag.BoolVar(&enableNginxInstrumentation, constants.FlagNginx, false, "Controls whether the operator supports nginx auto-instrumentation") - pflag.BoolVar(&enableNodeJSInstrumentation, constants.FlagNodeJS, false, "Controls whether the operator supports nodejs auto-instrumentation") + pflag.BoolVar(&enableNodeJSInstrumentation, constants.FlagNodeJS, true, "Controls whether the operator supports nodejs auto-instrumentation") pflag.BoolVar(&enableJavaInstrumentation, constants.FlagJava, true, "Controls whether the operator supports java auto-instrumentation") stringFlagOrEnv(&collectorImage, "collector-image", "RELATED_IMAGE_COLLECTOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.") stringFlagOrEnv(&targetAllocatorImage, "target-allocator-image", "RELATED_IMAGE_TARGET_ALLOCATOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/target-allocator:%s", v.TargetAllocator), "The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource.") From 6400503af17cfc6b6c4cd5b8b0d88d8a1421549c Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Mon, 29 Apr 2024 15:34:03 +0200 Subject: [PATCH 10/11] Removed feature flags Signed-off-by: Yuri Sa --- pkg/featuregate/featuregate.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/pkg/featuregate/featuregate.go b/pkg/featuregate/featuregate.go index 2e2798cc85..2d633c5276 100644 --- a/pkg/featuregate/featuregate.go +++ b/pkg/featuregate/featuregate.go @@ -25,25 +25,6 @@ const ( ) var ( - EnableNodeJSAutoInstrumentationSupport = featuregate.GlobalRegistry().MustRegister( - "operator.autoinstrumentation.nodejs", - featuregate.StageBeta, - featuregate.WithRegisterDescription("controls whether the operator supports NodeJS auto-instrumentation"), - featuregate.WithRegisterFromVersion("v0.76.1"), - ) - EnableNginxAutoInstrumentationSupport = featuregate.GlobalRegistry().MustRegister( - "operator.autoinstrumentation.nginx", - featuregate.StageAlpha, - featuregate.WithRegisterDescription("controls whether the operator supports Nginx auto-instrumentation"), - featuregate.WithRegisterFromVersion("v0.86.0"), - ) - EnableGoAutoInstrumentationSupport = featuregate.GlobalRegistry().MustRegister( - "operator.autoinstrumentation.go", - featuregate.StageAlpha, - featuregate.WithRegisterDescription("controls whether the operator supports Golang auto-instrumentation"), - featuregate.WithRegisterFromVersion("v0.77.0"), - ) - // PrometheusOperatorIsAvailable is the feature gate that enables features associated to the Prometheus Operator. PrometheusOperatorIsAvailable = featuregate.GlobalRegistry().MustRegister( "operator.observability.prometheus", From bd3197ed4d63b6d2687f3276c3f64f0c56fb268f Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Mon, 29 Apr 2024 16:40:59 +0200 Subject: [PATCH 11/11] Removed feature flags Signed-off-by: Yuri Sa --- .../manifests/opentelemetry-operator.clusterserviceversion.yaml | 1 - config/manager/manager.yaml | 1 - .../e2e-upgrade/upgrade-test/opentelemetry-operator-v0.86.0.yaml | 1 - 3 files changed, 3 deletions(-) diff --git a/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml index c8116daa19..eaea7882c1 100644 --- a/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -498,7 +498,6 @@ spec: - --enable-leader-election - --zap-log-level=info - --zap-time-encoding=rfc3339nano - - --feature-gates=+operator.autoinstrumentation.go - --enable-nginx-instrumentation=true image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.98.0 livenessProbe: diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 76eb71ac95..a329ad65ab 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -32,7 +32,6 @@ spec: - "--enable-leader-election" - "--zap-log-level=info" - "--zap-time-encoding=rfc3339nano" - - "--feature-gates=+operator.autoinstrumentation.go" - "--enable-nginx-instrumentation=true" image: controller name: manager diff --git a/tests/e2e-upgrade/upgrade-test/opentelemetry-operator-v0.86.0.yaml b/tests/e2e-upgrade/upgrade-test/opentelemetry-operator-v0.86.0.yaml index 12afe3893b..cc8a9cac64 100644 --- a/tests/e2e-upgrade/upgrade-test/opentelemetry-operator-v0.86.0.yaml +++ b/tests/e2e-upgrade/upgrade-test/opentelemetry-operator-v0.86.0.yaml @@ -8317,7 +8317,6 @@ spec: - --enable-leader-election - --zap-log-level=info - --zap-time-encoding=rfc3339nano - - --feature-gates=+operator.autoinstrumentation.go image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.86.0 livenessProbe: httpGet: