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

[otel] breaks sampling when used together with sentry middleware #788

Open
costela opened this issue Feb 23, 2024 · 0 comments
Open

[otel] breaks sampling when used together with sentry middleware #788

costela opened this issue Feb 23, 2024 · 0 comments

Comments

@costela
Copy link

costela commented Feb 23, 2024

Summary

This is a follow-up to #678, which was closed before the actual issue got resolved.

When using the otel integration for tracing, but sentry for exceptions, the sentry middleware always starts a transaction, which is then "invisible" to the otel integration (regardless of middleware ordering; more info in #679) and causes sampling decisions to diverge.

Steps To Reproduce

Initialize otel with:

trace.NewTracerProvider(
	trace.WithSampler(trace.AlwaysSample()),
	trace.WithSpanProcessor(sentryotel.NewSentrySpanProcessor()),
)

Initialize sentry with:

sentry.ClientOptions{
	//...
	EnableTracing:    true,
	TracesSampleRate: 0.0,
	//...
}

All traces created with otel.Tracer("").Start() will have span.IsSampled() == true, but none of them will be sent to sentry.

Switching the to NeverSample()/TracesSampleRate: 1.0 causes the opposite problem.

Expected Behavior

Both stacks would agree on sampling.

Environment

SDK

  • sentry-go version: v0.27.0
  • Go version: 1.22
  • Using Go Modules? yes

Sentry

  • Using hosted Sentry in sentry.io? yes
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

2 participants