sentry-go
sentry-go copied to clipboard
`sentryotel.TracerProvider` does not implement `go.opentelemetry.io/otel/trace.TracerProvider` in latest release
Summary
v0.27.0 of github.com/getsentry/sentry-go/otel does not implement the go.opentelemetry.io/otel/trace.TracerProvider interface define in the latest release of go.opentelemetry.io/otel/trace (1.24.0). It causes what should be otherwise be a straightforward APM configuration to break.
As a hack, I hard-coded old versions of otel packages in my go.mod file to v1.18.0 and also go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp to v0.45.0 instead of v0.49.0 so that the packages could still be compatible.
Steps To Reproduce
I followed the instructions in the the Sentry docs:
import (
"go.opentelemetry.io/otel"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"github.com/getsentry/sentry-go"
"github.com/getsentry/sentry-go/otel"
// ...
)
sentry.Init(sentry.ClientOptions{
Dsn: "https://a69f3adca34a44eeb1c26833e07bc699@o4504101533712384.ingest.us.sentry.io/4504101537841152",
EnableTracing: true,
TracesSampleRate: 1.0,
Debug: true,
})
tp := sdktrace.NewTracerProvider(
sdktrace.WithSpanProcessor(sentryotel.NewSentrySpanProcessor()),
)
otel.SetTracerProvider(tp)
otel.SetTextMapPropagator(sentryotel.NewSentryPropagator())
I get the following error when the otel packages are the latest versions (v1.24.0).
cannot use tp (variable of type *"go.opentelemetry.io/otel/sdk/trace".TracerProvider) as "go.opentelemetry.io/otel/trace".TracerProvider value in argument to otel.SetTracerProvider: *"go.opentelemetry.io/otel/sdk/trace".TracerProvider does not implement "go.opentelemetry.io/otel/trace".TracerProvider (missing method tracerProvider)
This seems to be the change this package needs to make to re-align with otel's package: https://github.com/open-telemetry/opentelemetry-go/blob/da2949b7bbc10fcb7bc1df8f54c68934ca4989e1/trace/trace.go#L536
Thanks so much for your time and help!
Expected Behavior
The configuration shown in the docs should work out-of-the-box, with the otel version.
Screenshots
Sentry.io Event
Environment
SDK
sentry-goversion: v0.27.0- Go version: v1.21.5
- Using Go Modules? [yes/no]
Sentry
- Using hosted Sentry in sentry.io? [yes/no] yes
- Using your own Sentry installation? Version:
- Anything particular to your environment that could be related to this issue?
Additional context
Lovely that they introduce breaking changes in a minor 1.x version. Will take a look.
I'm aware of the issue with latest release of open telemetry causing a breaking change, but I was unable to reproduce this with the provided snippet. Am I missing anything?
This runs just fine.: https://gist.github.com/ribice/e95a08d879adabe397c3a902d8fa32f1
@Sophie1142 Could you please provide a way for me to reproduce this? Thanks.