Skip to content

Commit

Permalink
Do not set TraceProvider to global (#5138)
Browse files Browse the repository at this point in the history
The reason is because soon we will have the config for the tracing/metrics providers in the main config (already started).
When this happens then we can have users "reconfigure" that via the watch API, and re-setting the global is not allowed in otel (also not restart friendly). Because of that we should break this behavior now, and not install the global.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Apr 4, 2022
1 parent d2e5601 commit 10ae1ef
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### 🛑 Breaking changes 🛑

- Remove deprecated structs/funcs from previous versions (#5131)
- Do not set TraceProvider to global otel (#5138)

### 🚩 Deprecations 🚩

Expand Down
5 changes: 0 additions & 5 deletions service/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"syscall"

"go.opentelemetry.io/contrib/zpages"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/nonrecording"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
Expand Down Expand Up @@ -231,10 +230,6 @@ func (col *Collector) Run(ctx context.Context) error {
sdktrace.WithSampler(internal.AlwaysRecord()),
sdktrace.WithSpanProcessor(col.zPagesSpanProcessor))

// Set the constructed tracer provider as Global, in case any component uses the
// global TracerProvider.
otel.SetTracerProvider(col.tracerProvider)

col.meterProvider = nonrecording.NewNoopMeterProvider()

col.asyncErrorChannel = make(chan error)
Expand Down

0 comments on commit 10ae1ef

Please sign in to comment.