Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentryotel.TracerProvider does not implement go.opentelemetry.io/otel/trace.TracerProvider in latest release #791

Open
Sophie1142 opened this issue Mar 6, 2024 · 3 comments
Assignees

Comments

@Sophie1142
Copy link

Sophie1142 commented Mar 6, 2024

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-go version: 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

@cleptric
Copy link
Member

cleptric commented Mar 6, 2024

Lovely that they introduce breaking changes in a minor 1.x version. Will take a look.

@ribice
Copy link
Collaborator

ribice commented Mar 12, 2024

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

@ribice
Copy link
Collaborator

ribice commented Mar 22, 2024

@Sophie1142 Could you please provide a way for me to reproduce this? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants