Skip to content

Commit 5f9ec2d

Browse files
committed
Remove 'telemetry.newPipelineTelemetry' feature gate
1 parent 55f569d commit 5f9ec2d

File tree

10 files changed

+61
-109
lines changed

10 files changed

+61
-109
lines changed

.chloggen/rm-attributes-gate.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: service
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Remove the `telemetry.newPipelineTelemetry` feature gate.
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [12856]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: []

internal/telemetry/telemetry.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,10 @@ import (
99
"go.opentelemetry.io/otel/trace"
1010
"go.uber.org/zap"
1111

12-
"go.opentelemetry.io/collector/featuregate"
1312
"go.opentelemetry.io/collector/internal/telemetry/componentattribute"
1413
"go.opentelemetry.io/collector/pdata/pcommon"
1514
)
1615

17-
var NewPipelineTelemetryGate = featuregate.GlobalRegistry().MustRegister(
18-
"telemetry.newPipelineTelemetry",
19-
featuregate.StageAlpha,
20-
featuregate.WithRegisterFromVersion("v0.123.0"),
21-
featuregate.WithRegisterDescription("Instruments Collector pipelines and injects component-identifying attributes"),
22-
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/rfcs/component-universal-telemetry.md"),
23-
)
24-
2516
// IMPORTANT: This struct is reexported as part of the public API of
2617
// go.opentelemetry.io/collector/component, a stable module.
2718
// DO NOT MAKE BREAKING CHANGES TO EXPORTED FIELDS.
@@ -46,16 +37,10 @@ type TelemetrySettings struct {
4637
// The publicization of this API is tracked in https://github.com/open-telemetry/opentelemetry-collector/issues/12405
4738

4839
func WithoutAttributes(ts TelemetrySettings, fields ...string) TelemetrySettings {
49-
if !NewPipelineTelemetryGate.IsEnabled() {
50-
return ts
51-
}
5240
return WithAttributeSet(ts, componentattribute.RemoveAttributes(ts.extraAttributes, fields...))
5341
}
5442

5543
func WithAttributeSet(ts TelemetrySettings, attrs attribute.Set) TelemetrySettings {
56-
if !NewPipelineTelemetryGate.IsEnabled() {
57-
return ts
58-
}
5944
ts.extraAttributes = attrs
6045
ts.Logger = componentattribute.ZapLoggerWithAttributes(ts.Logger, ts.extraAttributes)
6146
ts.TracerProvider = componentattribute.TracerProviderWithAttributes(ts.TracerProvider, ts.extraAttributes)

processor/memorylimiterprocessor/factory_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717

1818
"go.opentelemetry.io/collector/component/componenttest"
1919
"go.opentelemetry.io/collector/consumer/consumertest"
20-
"go.opentelemetry.io/collector/featuregate"
2120
"go.opentelemetry.io/collector/internal/memorylimiter"
2221
"go.opentelemetry.io/collector/internal/telemetry"
2322
"go.opentelemetry.io/collector/internal/telemetry/componentattribute"
@@ -34,17 +33,7 @@ func TestCreateDefaultConfig(t *testing.T) {
3433
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
3534
}
3635

37-
func setGate(t *testing.T, gate *featuregate.Gate, value bool) {
38-
initialValue := gate.IsEnabled()
39-
require.NoError(t, featuregate.GlobalRegistry().Set(gate.ID(), value))
40-
t.Cleanup(func() {
41-
_ = featuregate.GlobalRegistry().Set(gate.ID(), initialValue)
42-
})
43-
}
44-
4536
func TestCreateProcessor(t *testing.T) {
46-
setGate(t, telemetry.NewPipelineTelemetryGate, true)
47-
4837
factory := NewFactory()
4938
require.NotNil(t, factory)
5039

receiver/otlpreceiver/factory_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"go.opentelemetry.io/collector/consumer"
2222
"go.opentelemetry.io/collector/consumer/consumertest"
2323
"go.opentelemetry.io/collector/consumer/xconsumer"
24-
"go.opentelemetry.io/collector/featuregate"
2524
"go.opentelemetry.io/collector/internal/telemetry"
2625
"go.opentelemetry.io/collector/internal/telemetry/componentattribute"
2726
"go.opentelemetry.io/collector/internal/testutil"
@@ -37,17 +36,7 @@ func TestCreateDefaultConfig(t *testing.T) {
3736
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
3837
}
3938

40-
func setGate(t *testing.T, gate *featuregate.Gate, value bool) {
41-
initialValue := gate.IsEnabled()
42-
require.NoError(t, featuregate.GlobalRegistry().Set(gate.ID(), value))
43-
t.Cleanup(func() {
44-
_ = featuregate.GlobalRegistry().Set(gate.ID(), initialValue)
45-
})
46-
}
47-
4839
func TestCreateSameReceiver(t *testing.T) {
49-
setGate(t, telemetry.NewPipelineTelemetryGate, true)
50-
5140
factory := NewFactory()
5241
cfg := factory.CreateDefaultConfig().(*Config)
5342
cfg.GRPC.NetAddr.Endpoint = testutil.GetAvailableLocalAddress(t)

service/internal/graph/connector.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ func (n *connectorNode) buildComponent(
4949
builder *builders.ConnectorBuilder,
5050
nexts []baseConsumer,
5151
) error {
52-
set := connector.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info}
53-
if telemetry.NewPipelineTelemetryGate.IsEnabled() {
54-
set.TelemetrySettings = telemetry.WithAttributeSet(set.TelemetrySettings, *n.Set())
52+
set := connector.Settings{
53+
ID: n.componentID,
54+
TelemetrySettings: telemetry.WithAttributeSet(tel, *n.Set()),
55+
BuildInfo: info,
5556
}
57+
5658
switch n.rcvrPipelineType {
5759
case pipeline.SignalTraces:
5860
return n.buildTraces(ctx, set, builder, nexts)

service/internal/graph/exporter.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ func (n *exporterNode) buildComponent(
4545
info component.BuildInfo,
4646
builder *builders.ExporterBuilder,
4747
) error {
48-
set := exporter.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info}
49-
if telemetry.NewPipelineTelemetryGate.IsEnabled() {
50-
set.TelemetrySettings = telemetry.WithAttributeSet(set.TelemetrySettings, *n.Set())
48+
set := exporter.Settings{
49+
ID: n.componentID,
50+
TelemetrySettings: telemetry.WithAttributeSet(tel, *n.Set()),
51+
BuildInfo: info,
5152
}
53+
5254
var err error
5355
switch n.pipelineType {
5456
case pipeline.SignalTraces:

service/internal/graph/processor.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ func (n *processorNode) buildComponent(ctx context.Context,
4747
builder *builders.ProcessorBuilder,
4848
next baseConsumer,
4949
) error {
50-
set := processor.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info}
51-
if telemetry.NewPipelineTelemetryGate.IsEnabled() {
52-
set.TelemetrySettings = telemetry.WithAttributeSet(set.TelemetrySettings, *n.Set())
50+
set := processor.Settings{
51+
ID: n.componentID,
52+
TelemetrySettings: telemetry.WithAttributeSet(tel, *n.Set()),
53+
BuildInfo: info,
5354
}
55+
5456
var err error
5557
switch n.pipelineID.Signal() {
5658
case pipeline.SignalTraces:

service/internal/graph/receiver.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ func (n *receiverNode) buildComponent(ctx context.Context,
4242
builder *builders.ReceiverBuilder,
4343
nexts []baseConsumer,
4444
) error {
45-
set := receiver.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info}
46-
if telemetry.NewPipelineTelemetryGate.IsEnabled() {
47-
set.TelemetrySettings = telemetry.WithAttributeSet(set.TelemetrySettings, *n.Set())
45+
set := receiver.Settings{
46+
ID: n.componentID,
47+
TelemetrySettings: telemetry.WithAttributeSet(tel, *n.Set()),
48+
BuildInfo: info,
4849
}
50+
4951
var err error
5052
switch n.pipelineType {
5153
case pipeline.SignalTraces:

service/telemetry/logger.go

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
package telemetry // import "go.opentelemetry.io/collector/service/telemetry"
55

66
import (
7-
"go.opentelemetry.io/contrib/bridges/otelzap"
87
"go.opentelemetry.io/otel/attribute"
98
"go.opentelemetry.io/otel/log"
109
"go.uber.org/zap"
1110
"go.uber.org/zap/zapcore"
1211

13-
"go.opentelemetry.io/collector/internal/telemetry"
1412
"go.opentelemetry.io/collector/internal/telemetry/componentattribute"
1513
)
1614

@@ -43,54 +41,29 @@ func newLogger(set Settings, cfg Config) (*zap.Logger, log.LoggerProvider, error
4341

4442
var lp log.LoggerProvider
4543

46-
if telemetry.NewPipelineTelemetryGate.IsEnabled() {
47-
logger = logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core {
48-
core = componentattribute.NewConsoleCoreWithAttributes(core, attribute.NewSet())
44+
logger = logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core {
45+
core = componentattribute.NewConsoleCoreWithAttributes(core, attribute.NewSet())
4946

50-
if len(cfg.Logs.Processors) > 0 && set.SDK != nil {
51-
lp = set.SDK.LoggerProvider()
52-
53-
core = componentattribute.NewOTelTeeCoreWithAttributes(
54-
core,
55-
lp,
56-
"go.opentelemetry.io/collector/service/telemetry",
57-
cfg.Logs.Level,
58-
attribute.NewSet(),
59-
)
60-
}
61-
62-
if cfg.Logs.Sampling != nil && cfg.Logs.Sampling.Enabled {
63-
core = componentattribute.NewWrapperCoreWithAttributes(core, func(c zapcore.Core) zapcore.Core {
64-
return newSampledCore(c, cfg.Logs.Sampling)
65-
})
66-
}
67-
68-
return core
69-
}))
70-
} else {
7147
if len(cfg.Logs.Processors) > 0 && set.SDK != nil {
7248
lp = set.SDK.LoggerProvider()
7349

74-
logger = logger.WithOptions(zap.WrapCore(func(c zapcore.Core) zapcore.Core {
75-
core, err := zapcore.NewIncreaseLevelCore(zapcore.NewTee(
76-
c,
77-
otelzap.NewCore("go.opentelemetry.io/collector/service/telemetry",
78-
otelzap.WithLoggerProvider(lp),
79-
),
80-
), zap.NewAtomicLevelAt(cfg.Logs.Level))
81-
if err != nil {
82-
panic(err)
83-
}
84-
return core
85-
}))
50+
core = componentattribute.NewOTelTeeCoreWithAttributes(
51+
core,
52+
lp,
53+
"go.opentelemetry.io/collector/service/telemetry",
54+
cfg.Logs.Level,
55+
attribute.NewSet(),
56+
)
8657
}
8758

8859
if cfg.Logs.Sampling != nil && cfg.Logs.Sampling.Enabled {
89-
logger = logger.WithOptions(zap.WrapCore(func(c zapcore.Core) zapcore.Core {
60+
core = componentattribute.NewWrapperCoreWithAttributes(core, func(c zapcore.Core) zapcore.Core {
9061
return newSampledCore(c, cfg.Logs.Sampling)
91-
}))
62+
})
9263
}
93-
}
64+
65+
return core
66+
}))
9467

9568
return logger, lp, nil
9669
}

service/telemetry/logger_test.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,8 @@ import (
1313
"github.com/stretchr/testify/require"
1414
config "go.opentelemetry.io/contrib/otelconf/v0.3.0"
1515
"go.uber.org/zap/zapcore"
16-
17-
"go.opentelemetry.io/collector/featuregate"
18-
"go.opentelemetry.io/collector/internal/telemetry"
1916
)
2017

21-
func setGate(t *testing.T, gate *featuregate.Gate, value bool) {
22-
initialValue := gate.IsEnabled()
23-
require.NoError(t, featuregate.GlobalRegistry().Set(gate.ID(), value))
24-
t.Cleanup(func() {
25-
_ = featuregate.GlobalRegistry().Set(gate.ID(), initialValue)
26-
})
27-
}
28-
2918
func TestNewLogger(t *testing.T) {
3019
tests := []struct {
3120
name string
@@ -125,13 +114,7 @@ func TestNewLogger(t *testing.T) {
125114
}
126115
}
127116
}
128-
t.Run(tt.name, func(t *testing.T) {
129-
setGate(t, telemetry.NewPipelineTelemetryGate, false)
130-
testCoreType(t, tt.wantCoreType)
131-
})
132-
t.Run(tt.name+" (pipeline telemetry on)", func(t *testing.T) {
133-
setGate(t, telemetry.NewPipelineTelemetryGate, true)
134-
testCoreType(t, tt.wantCoreTypeRfc)
135-
})
117+
118+
testCoreType(t, tt.wantCoreTypeRfc)
136119
}
137120
}

0 commit comments

Comments
 (0)