Skip to content

Commit bbc908f

Browse files
Merge branch 'main' into rashmi/keepequal-fix
2 parents 3542e28 + aeb19a7 commit bbc908f

26 files changed

+227
-222
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: bug_fix
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: collector
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Fix the RBAC resources creation when the processor was only enabled"
9+
10+
# One or more tracking issues related to the change
11+
issues: [2788]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: breaking
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
5+
component: operator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: change nginx instrumentation feature gate operator.autoinstrumentation.nginx into command line flag --enable-nginx-instrumentation
9+
10+
# One or more tracking issues related to the change
11+
issues: [2582, 2676]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

.chloggen/js-build-remove-dev.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: auto-instrumentation
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Remove NodeJS autoinstrumentation dev dependencies to reduce image size"
9+
10+
# One or more tracking issues related to the change
11+
issues: [2802]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: breaking
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: target allocator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Promote `operator.collector.rewritetargetallocator` feature flag to stable
9+
10+
# One or more tracking issues related to the change
11+
issues: [2796]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

autoinstrumentation/java/version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.0
1+
2.2.0

autoinstrumentation/nodejs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"clean": "rimraf build/*",
77
"prepare": "npm run compile",
88
"compile": "tsc -p .",
9-
"postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' build/workspace/"
9+
"postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' package.json build/workspace/ && npm -C build/workspace prune --omit=dev --no-package-lock"
1010
},
1111
"devDependencies": {
1212
"copyfiles": "^2.4.1",

bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ metadata:
9999
categories: Logging & Tracing,Monitoring
100100
certified: "false"
101101
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
102-
createdAt: "2024-03-11T13:32:19Z"
102+
createdAt: "2024-03-25T08:38:05Z"
103103
description: Provides the OpenTelemetry components, including the Collector
104104
operators.operatorframework.io/builder: operator-sdk-v1.29.0
105105
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
@@ -487,7 +487,8 @@ spec:
487487
- --enable-leader-election
488488
- --zap-log-level=info
489489
- --zap-time-encoding=rfc3339nano
490-
- --feature-gates=+operator.autoinstrumentation.go,+operator.autoinstrumentation.nginx
490+
- --feature-gates=+operator.autoinstrumentation.go
491+
- --enable-nginx-instrumentation=true
491492
image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.96.0
492493
livenessProbe:
493494
httpGet:

config/manager/manager.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ spec:
3232
- "--enable-leader-election"
3333
- "--zap-log-level=info"
3434
- "--zap-time-encoding=rfc3339nano"
35-
- "--feature-gates=+operator.autoinstrumentation.go,+operator.autoinstrumentation.nginx"
35+
- "--feature-gates=+operator.autoinstrumentation.go"
36+
- "--enable-nginx-instrumentation=true"
3637
image: controller
3738
name: manager
3839
livenessProbe:

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.2
2525
github.com/prometheus-operator/prometheus-operator/pkg/client v0.71.2
2626
github.com/prometheus/client_golang v1.19.0
27-
github.com/prometheus/common v0.50.0
27+
github.com/prometheus/common v0.51.1
2828
github.com/prometheus/prometheus v0.50.1
2929
github.com/shirou/gopsutil v3.21.11+incompatible
3030
github.com/spf13/pflag v1.0.5

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b
576576
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
577577
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
578578
github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
579-
github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ=
580-
github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ=
579+
github.com/prometheus/common v0.51.1 h1:eIjN50Bwglz6a/c3hAgSMcofL3nD+nFQkV6Dd4DsQCw=
580+
github.com/prometheus/common v0.51.1/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q=
581581
github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4=
582582
github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI=
583583
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=

internal/config/main.go

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type Config struct {
4646
enableMultiInstrumentation bool
4747
enableApacheHttpdInstrumentation bool
4848
enableDotNetInstrumentation bool
49+
enableNginxInstrumentation bool
4950
enablePythonInstrumentation bool
5051
autoInstrumentationDotNetImage string
5152
autoInstrumentationGoImage string
@@ -83,6 +84,7 @@ func New(opts ...Option) Config {
8384
enableMultiInstrumentation: o.enableMultiInstrumentation,
8485
enableApacheHttpdInstrumentation: o.enableApacheHttpdInstrumentation,
8586
enableDotNetInstrumentation: o.enableDotNetInstrumentation,
87+
enableNginxInstrumentation: o.enableNginxInstrumentation,
8688
enablePythonInstrumentation: o.enablePythonInstrumentation,
8789
targetAllocatorImage: o.targetAllocatorImage,
8890
operatorOpAMPBridgeImage: o.operatorOpAMPBridgeImage,
@@ -134,6 +136,11 @@ func (c *Config) EnableDotNetAutoInstrumentation() bool {
134136
return c.enableDotNetInstrumentation
135137
}
136138

139+
// EnableNginxAutoInstrumentation is true when the operator supports nginx auto instrumentation.
140+
func (c *Config) EnableNginxAutoInstrumentation() bool {
141+
return c.enableNginxInstrumentation
142+
}
143+
137144
// EnablePythonAutoInstrumentation is true when the operator supports dotnet auto instrumentation.
138145
func (c *Config) EnablePythonAutoInstrumentation() bool {
139146
return c.enablePythonInstrumentation

internal/config/options.go

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type options struct {
4545
enableMultiInstrumentation bool
4646
enableApacheHttpdInstrumentation bool
4747
enableDotNetInstrumentation bool
48+
enableNginxInstrumentation bool
4849
enablePythonInstrumentation bool
4950
targetAllocatorConfigMapEntry string
5051
operatorOpAMPBridgeConfigMapEntry string
@@ -100,6 +101,11 @@ func WithEnableDotNetInstrumentation(s bool) Option {
100101
o.enableDotNetInstrumentation = s
101102
}
102103
}
104+
func WithEnableNginxInstrumentation(s bool) Option {
105+
return func(o *options) {
106+
o.enableNginxInstrumentation = s
107+
}
108+
}
103109
func WithEnablePythonInstrumentation(s bool) Option {
104110
return func(o *options) {
105111
o.enablePythonInstrumentation = s

internal/manifests/collector/adapters/config_to_ports.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func ConfigToComponentPorts(logger logr.Logger, cType ComponentType, config map[
100100
}
101101

102102
if err != nil {
103-
logger.V(2).Info("no parser found for '%s'", cmptName)
103+
logger.V(2).Info("no parser found for", "component", cmptName)
104104
continue
105105
}
106106

internal/manifests/collector/adapters/config_to_rbac.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func ConfigToRBAC(logger logr.Logger, config map[interface{}]interface{}) []rbac
5252
processorName := key.(string)
5353
processorParser, err := processor.For(logger, processorName, processorCfg)
5454
if err != nil {
55-
logger.V(2).Info("no parser found for '%s'", processorName)
55+
logger.V(2).Info("no parser found for", "processor", processorName)
5656
continue
5757
}
5858

internal/manifests/collector/config_replace_test.go

+1-60
Original file line numberDiff line numberDiff line change
@@ -18,57 +18,17 @@ import (
1818
"os"
1919
"testing"
2020

21-
"github.com/prometheus/prometheus/discovery/http"
2221
"github.com/stretchr/testify/assert"
2322
"github.com/stretchr/testify/require"
24-
colfeaturegate "go.opentelemetry.io/collector/featuregate"
2523
"gopkg.in/yaml.v2"
2624

2725
ta "github.com/open-telemetry/opentelemetry-operator/internal/manifests/targetallocator/adapters"
28-
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
2926
)
3027

3128
func TestPrometheusParser(t *testing.T) {
3229
param, err := newParams("test/test-img", "testdata/http_sd_config_test.yaml")
3330
assert.NoError(t, err)
3431

35-
t.Run("should update config with http_sd_config", func(t *testing.T) {
36-
err := colfeaturegate.GlobalRegistry().Set(featuregate.EnableTargetAllocatorRewrite.ID(), false)
37-
require.NoError(t, err)
38-
t.Cleanup(func() {
39-
_ = colfeaturegate.GlobalRegistry().Set(featuregate.EnableTargetAllocatorRewrite.ID(), true)
40-
})
41-
actualConfig, err := ReplaceConfig(param.OtelCol)
42-
assert.NoError(t, err)
43-
44-
// prepare
45-
var cfg Config
46-
promCfgMap, err := ta.ConfigToPromConfig(actualConfig)
47-
assert.NoError(t, err)
48-
49-
promCfg, err := yaml.Marshal(promCfgMap)
50-
assert.NoError(t, err)
51-
52-
err = yaml.UnmarshalStrict(promCfg, &cfg)
53-
assert.NoError(t, err)
54-
55-
// test
56-
expectedMap := map[string]bool{
57-
"prometheus": false,
58-
"service-x": false,
59-
}
60-
for _, scrapeConfig := range cfg.PromConfig.ScrapeConfigs {
61-
assert.Len(t, scrapeConfig.ServiceDiscoveryConfigs, 1)
62-
assert.Equal(t, scrapeConfig.ServiceDiscoveryConfigs[0].Name(), "http")
63-
assert.Equal(t, scrapeConfig.ServiceDiscoveryConfigs[0].(*http.SDConfig).URL, "http://test-targetallocator:80/jobs/"+scrapeConfig.JobName+"/targets?collector_id=$POD_NAME")
64-
expectedMap[scrapeConfig.JobName] = true
65-
}
66-
for k := range expectedMap {
67-
assert.True(t, expectedMap[k], k)
68-
}
69-
assert.True(t, cfg.TargetAllocConfig == nil)
70-
})
71-
7232
t.Run("should update config with targetAllocator block if block not present", func(t *testing.T) {
7333
// Set up the test scenario
7434
param.OtelCol.Spec.TargetAllocator.Enabled = true
@@ -171,26 +131,7 @@ func TestReplaceConfig(t *testing.T) {
171131
assert.YAMLEq(t, expectedConfig, actualConfig)
172132
})
173133

174-
t.Run("should rewrite scrape configs with SD config when TargetAllocator is enabled and feature flag is not set", func(t *testing.T) {
175-
err := colfeaturegate.GlobalRegistry().Set(featuregate.EnableTargetAllocatorRewrite.ID(), false)
176-
require.NoError(t, err)
177-
t.Cleanup(func() {
178-
_ = colfeaturegate.GlobalRegistry().Set(featuregate.EnableTargetAllocatorRewrite.ID(), true)
179-
})
180-
181-
param.OtelCol.Spec.TargetAllocator.Enabled = true
182-
183-
expectedConfigBytes, err := os.ReadFile("testdata/relabel_config_expected_with_sd_config.yaml")
184-
assert.NoError(t, err)
185-
expectedConfig := string(expectedConfigBytes)
186-
187-
actualConfig, err := ReplaceConfig(param.OtelCol)
188-
assert.NoError(t, err)
189-
190-
assert.YAMLEq(t, expectedConfig, actualConfig)
191-
})
192-
193-
t.Run("should remove scrape configs if TargetAllocator is enabled and feature flag is set", func(t *testing.T) {
134+
t.Run("should remove scrape configs if TargetAllocator is enabled", func(t *testing.T) {
194135
param.OtelCol.Spec.TargetAllocator.Enabled = true
195136

196137
expectedConfigBytes, err := os.ReadFile("testdata/config_expected_targetallocator.yaml")

0 commit comments

Comments
 (0)