-
-
Notifications
You must be signed in to change notification settings - Fork 461
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
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
otelwe don't clone a new hub inSentryWebFilter- 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
- We'll probably instead have to clone a new hub from main hub in
- 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.
Beta Was this translation helpful? Give feedback.
All reactions
-
@sleep-dev I've opened #2726 and written down some workarounds. If you decide to give those a try, please leave feedback.
Beta Was this translation helpful? Give feedback.