-
Notifications
You must be signed in to change notification settings - Fork 916
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
Spring Webflux Context issue with TRACE_CONTEXT_KEY
#13475
Comments
hi @dlefler-chwy! I suspect you'll need to go to data dog for this question |
Hi @trask! Thanks for the pointer. I took some time yesterday to try to see if I could get my code to run locally with the I am relatively new to webflux as well as setting up observability but what would make you think that the |
if you can create a minimal repro (preferably as a github repository with instructions) of the issue using the opentelemetry-javaagent that would be great |
@trask here is a project reproing the issue: https://github.com/dlefler-chwy/webflux-otel-context-issue |
I think the issue is that you are using global open telemetry in https://github.com/dlefler-chwy/webflux-otel-context-issue/blob/fe913a0547e203a53299d4c7fc291097ad288730/src/main/java/com/example/reactivewebservice/ReactiveWebServiceApplication.java#L22 Global open telemetry is meant to be used with the java agent where it returns the open telemetry instance configured by the agent. By default it will return a no-op instance that doesn't do anything. If you'd replace it with |
Thanks @laurit. I tried running a debugger on the application start up for my sample application and the
I think the warning makes sense since the sample project does use the agent so we would expect it to configure the OpenTelemty instance over the sdk. As per the suggestion about adding to the span, shouldn't using |
So you are using the agent. In that case
Instrumentation restores the ThreadLocal context for the reactive callbacks so |
Thanks @laurit for clarifying usage. I think that this thread can be closed as I think auto instrumentation should be able to support our use cases. |
I have been attempting to get open telemetry working in my Spring Webflux application. The application uses a data dog java agent. Below is the configuration:
Spring boot version: 3.4.1
Spring webflux version: 6.2.1
opentelemetry-sdk version: 1.47.0
opentelemetry-api version: 1.47.0
opentelemetry-sdk-extension-autoconfigure: 1.47.0
opentelemetry-spring-webflux-5.3: 2.12.0-alpha
I am able to successfully instrument my application using just the open telemetry api. However, I want to add custom span attributes to my spans and in order to do this, I added
opentelemetry-spring-webflux-5.3: 2.12.0-alpha
. The reason I thought that this library would help access the correct span was thatTRACE_CONTEXT_KEY
would be added to the reactor context. When debugging my application, I do not see this in the reactor context and stepping through the code,storeOpenTelemetryContext
is never called.Is there something wrong with the way I have set this up? I have set up the correct beans following the README for the webflux library. Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: