Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sentry-spring-boot-starter with sentry-opentelemetry-core #2715

Unanswered
sleep-dev asked this question in Q&A
Discussion options

Hello team.

I found something strange while developing.
When using the sentry-spring-boot-starter and the Opentelemetry Agent at the same time, it seems that configuring scope on the user code does not reflect on result.
Is there anyway to controll the hub made by sentry-opentelemtry-core?

code like below (kotlin)

@RestController
class HelloWorld {
 @GetMapping("/hello")
 fun helloWorld() : Mono<String> {
 val hub = Sentry.getCurrentHub()
 hub.configureScope {
 //do something on scope
 }
 return Mono.just("Hello")
 }

application.properties

sentry.dsn={DSN String}
sentry.instrumenter=otel
sentry.debug=true

vm option
-javaagent: {Path to OpentelemetryAgent}

ENV

SENTRY_AUTO_INIT=false

gradle

 implementation("io.sentry:sentry-opentelemetry-core:6.19.0")
 implementation("io.sentry:sentry-spring-boot-starter:6.19.0")

I found that hub.configureScope Section apply to hub from SentryWebFilter which is NoOp.
If I remove the SentryWebFilter and SentryWebTracingFilter then Sentry.getCurrentHub() makes clone of the mainHub in runtime.

If I use io.sentry:sentry and io.sentry:sentry-opentelemetry-core (with env SENTRY_AUTO_INIT=true) then the result shows what I want ( the hub.configureScope applies to result)

I'm sorry for posting several questions. Thank you always.

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Hello @sleep-dev, this looks like another bug in the SDK.

The problem seems to be us cloning a new hub from the main hub. While pushing and popping of scopes seems problematic as well the order of executions suggests that's not an issue - at least for WebFlux.

When the transaction is created in SentrySpanProcessor it uses the current hub via HubAdapter. When the transaction is finished it's still bound to that hub therefore ignoring anything set on the other hub (created by SentryWebFilter).

Possible fixes:

  • If instrumenter is otel we don't clone a new hub in SentryWebFilter
    • We'll probably instead have to clone a new hub from main hub in SentrySpanProcessor
    • Scope push / pop may also have to go into SentrySpanProcessor
  • Let the transaction use the current hub on finish instead of the one used when creating the transaction

This may be a bug affecting other Sentry SDKs and integrations with OpenTelemetry support as well. I'll discuss with the team.

You must be logged in to vote
1 reply
Comment options

@sleep-dev I've opened #2726 and written down some workarounds. If you decide to give those a try, please leave feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /