opentelemetry-java-instrumentation
opentelemetry-java-instrumentation copied to clipboard
Span.current() is not propagating with Vertx virtual threads
Describe the bug
Hi Otel team,
My team builds an API using Vertx and we use the Java Auto Instrumentation Agent via the Kubernetes Operator.
We have recently switched over to using the new Vertx verticle virtual threading model, and our Span propagation is no longer working. We embellish the Span created by Netty by adding custom attributes, events, and change the default span name from the HTTP verb to the normalized route path. Inside our RoutingContext handlers, Span.current()
now points to a no-op Span instead of the Netty span it was pointing to before we switched to virtual threads.
I've put together a thorough repro which demonstrates this behaviour, as well as showing it works with the standard threading model, as well as when manually confuring the OpenTelemetry SDK with Vertx and virtual threads.
Repro: https://github.com/cjbhaines/vertx-otel-span-repro
Please let me know if there is anything I can do to assist!
Thanks, Chris
Steps to reproduce
See repro: https://github.com/cjbhaines/vertx-otel-span-repro
Expected behavior
Span.current() points to the span created by Netty in RoutingContext handlers.
Actual behavior
Span.current() points to a no-op span.
Javaagent or library instrumentation version
2.0.0
Environment
- OpenTelemetry Java Automatic Instrumentation Agent: 2.0.0
- OpenTelemetry Java SDK: 1.35.0
- Vertx version: 4.5.3
- Java Version:
- openjdk 21.0.2 2024-01-16 LTS
- OpenJDK Runtime Environment Corretto-21.0.2.13.1 (build 21.0.2+13-LTS)
- OpenJDK 64-Bit Server VM Corretto-21.0.2.13.1 (build 21.0.2+13-LTS, mixed mode, sharing)
- OS for repro: macOS 14.0 (23A344)
Additional context
No response