Skip to content

Commit d0904ce

Browse files
committed
remove unused sampler configuration
Signed-off-by: Alex Boten <[email protected]>
1 parent 59c1ce0 commit d0904ce

File tree

5 files changed

+73
-31
lines changed

5 files changed

+73
-31
lines changed
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: bug_fix
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: ensure the tracer provider is configured via go.opentelemetry.io/contrib/config
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [9967]
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: []

service/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ require (
3232
go.opentelemetry.io/otel/bridge/opencensus v1.25.0
3333
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.25.0
3434
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.25.0
35-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.25.0
36-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0
3735
go.opentelemetry.io/otel/exporters/prometheus v0.47.0
3836
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.25.0
39-
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.25.0
4037
go.opentelemetry.io/otel/metric v1.25.0
4138
go.opentelemetry.io/otel/sdk v1.25.0
4239
go.opentelemetry.io/otel/sdk/metric v1.25.0
@@ -78,6 +75,9 @@ require (
7875
github.com/yusufpapurcu/wmi v1.2.4 // indirect
7976
go.opentelemetry.io/contrib/zpages v0.50.0 // indirect
8077
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.25.0 // indirect
78+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.25.0 // indirect
79+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0 // indirect
80+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.25.0 // indirect
8181
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
8282
golang.org/x/net v0.23.0 // indirect
8383
golang.org/x/sys v0.19.0 // indirect

service/telemetry/otel_trace_sampler.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

service/telemetry/telemetry.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,25 @@ func New(ctx context.Context, set Settings, cfg Config) (*Telemetry, error) {
7373
config.OpenTelemetryConfiguration{
7474
TracerProvider: &config.TracerProvider{
7575
Processors: cfg.Traces.Processors,
76+
// TODO: once https://github.com/open-telemetry/opentelemetry-configuration/issues/83 is resolved,
77+
// configuration for sampler should be done here via something like the following:
78+
//
79+
// Sampler: &config.Sampler{
80+
// ParentBased: &config.SamplerParentBased{
81+
// LocalParentSampled: &config.Sampler{
82+
// AlwaysOn: config.SamplerAlwaysOn{},
83+
// },
84+
// LocalParentNotSampled: &config.Sampler{
85+
// RecordOnly: config.SamplerRecordOnly{},
86+
// },
87+
// RemoteParentSampled: &config.Sampler{
88+
// AlwaysOn: config.SamplerAlwaysOn{},
89+
// },
90+
// RemoteParentNotSampled: &config.Sampler{
91+
// RecordOnly: config.SamplerRecordOnly{},
92+
// },
93+
// },
94+
// },
7695
},
7796
},
7897
),

service/telemetry/telemetry_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ import (
99
"time"
1010

1111
"github.com/stretchr/testify/assert"
12+
"github.com/stretchr/testify/require"
1213
"go.uber.org/zap"
1314
"go.uber.org/zap/zapcore"
1415

1516
"go.opentelemetry.io/collector/config/configtelemetry"
17+
"go.opentelemetry.io/otel/trace"
18+
"go.opentelemetry.io/otel/trace/noop"
1619
)
1720

1821
func TestTelemetryConfiguration(t *testing.T) {
@@ -115,3 +118,26 @@ func TestSampledLogger(t *testing.T) {
115118
})
116119
}
117120
}
121+
122+
func TestTelemetryShutdown(t *testing.T) {
123+
tests := []struct {
124+
name string
125+
provider trace.TracerProvider
126+
wantErr error
127+
}{
128+
{
129+
name: "No provider",
130+
},
131+
{
132+
name: "Non-SDK provider",
133+
provider: noop.NewTracerProvider(),
134+
},
135+
}
136+
for _, tt := range tests {
137+
t.Run(tt.name, func(t *testing.T) {
138+
telemetry := Telemetry{tracerProvider: tt.provider}
139+
err := telemetry.Shutdown(context.Background())
140+
require.Equal(t, tt.wantErr, err)
141+
})
142+
}
143+
}

0 commit comments

Comments
 (0)