Add instrumentation for vert.x TaskQueue#18709
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Javaagent instrumentation to propagate OpenTelemetry Context through Vert.x internal io.vertx.core.impl.TaskQueue, aiming to stabilize high-concurrency context propagation (notably VertxReactivePropagationTest.highConcurrency).
Changes:
- Introduces
TaskQueueInstrumentationto wrap/propagate context for tasks submitted viaTaskQueue.execute(Runnable). - Adds executors bootstrap dependency to support context-propagating runnable helpers.
- Registers the new type instrumentation in Vert.x HTTP client javaagent modules for 3.0, 4.0, and 5.0.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| instrumentation/vertx/vertx-http-client/vertx-http-client-common-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/httpclient/common/v3_0/TaskQueueInstrumentation.java | New ByteBuddy advice to propagate context on TaskQueue.execute(Runnable) and clear thread context during internal queue consumption setup. |
| instrumentation/vertx/vertx-http-client/vertx-http-client-common-3.0/javaagent/build.gradle.kts | Adds executors bootstrap dependency needed by the new instrumentation. |
| instrumentation/vertx/vertx-http-client/vertx-http-client-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/httpclient/v5_0/VertxClientInstrumentationModule.java | Registers TaskQueueInstrumentation for Vert.x 5 HTTP client instrumentation. |
| instrumentation/vertx/vertx-http-client/vertx-http-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/httpclient/v4_0/VertxClientInstrumentationModule.java | Registers TaskQueueInstrumentation for Vert.x 4 HTTP client instrumentation. |
| instrumentation/vertx/vertx-http-client/vertx-http-client-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/httpclient/v3_0/VertxClientInstrumentationModule.java | Registers TaskQueueInstrumentation for Vert.x 3 HTTP client instrumentation. |
Comment on lines
+41
to
+50
| public static Object[] onEnter(@Advice.Argument(0) Runnable task) { | ||
| // Attach context to the task being executed and prevent further context propagation in this | ||
| // method. This method places the task into queue and executes a runnable that start consuming | ||
| // tasks from the queue. Since we already attached context to the task, we don't want to | ||
| // propagate context into the runnable that consumes tasks from the queue. | ||
| Context context = Java8BytecodeBridge.currentContext(); | ||
| return new Object[] { | ||
| ContextPropagatingRunnable.propagateContext(task, context), | ||
| Java8BytecodeBridge.rootContext().makeCurrent() | ||
| }; |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jaydeluca
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hopefully fixes flakiness of
VertxReactivePropagationTest.highConcurrency