Deprecate AgentScope.Continuation and migrate call sites to ContextContinuation#11951
Deprecate AgentScope.Continuation and migrate call sites to ContextContinuation#11951mcculls wants to merge 6 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4041cbed27
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
More details
The migration is behaviorally faithful: resume()/release() in ScopeContinuation are the new primary implementations with activate()/cancel() delegating to them, the (AgentScope) resume() cast is safe (both return paths give ContinuableScope or NoopScope), and ContinuableScopeManager's explicit installLegacyContextManager() call is correctly wired in Agent bootstrap, native-image activation, and all test bases. Two SQS test classes covering the non-legacy path are intentionally @Disabled pending the broader migration (APMLP-829).
📊 Validated against 23 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit 4041cbe · What is Autotest? · Any feedback? Reach out in #autotest
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
Kafka / consumer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
09dab12 to
ed5b5ef
Compare
Kafka / producer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
55ebf56 to
f26db87
Compare
…ntinuation AgentScope.Continuation was a bridging interface that extended both TraceScope.Continuation (public API) and ContextContinuation (modern context API). It is now @deprecated — internal call sites migrate to ContextContinuation directly. Key changes: - AgentScope.Continuation marked @deprecated - AgentTraceCollector.register/removeContinuation now accept ContextContinuation - AgentTracer.captureActiveSpan()/captureSpan() static methods return ContextContinuation (implementations still return AgentScope.Continuation for Tracer interface compat) - ScopeContinuation gains resume()/release() for the ContextContinuation contract - State, ConcurrentState, Wrapper, VirtualThreadState, AdviceUtils, TPEHelper all migrated from AgentScope.Continuation to ContextContinuation/ContextScope - ~85 instrumentation files updated: field types use ContextContinuation, activate()→resume(), cancel()→release(), scope types use ContextScope Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f26db87 to
7ddef31
Compare
…gent-scope-continuation-1-migrate-call-sites
PerfectSlayer
left a comment
There was a problem hiding this comment.
Left minor questions about possible behavior change (just need confirmation) and about some null-checks - if we need to start adding some even if they should not throw for now. This can be in follow up PR if ever needed.
| } | ||
| RedissonClientDecorator.DECORATE.beforeFinish(scope); | ||
| scope.span().finish(); | ||
| AgentSpan.fromContext(scope.context()).finish(); |
There was a problem hiding this comment.
💭 thought: Should we handle null span here?
There was a problem hiding this comment.
See #11951 (comment) - we can avoid null checks when we are sure that the captured continuation's context contained a span.
| } | ||
| RedissonClientDecorator.DECORATE.beforeFinish(scope); | ||
| scope.span().finish(); | ||
| AgentSpan.fromContext(scope.context()).finish(); |
There was a problem hiding this comment.
❔ question: Same question about null span here too
There was a problem hiding this comment.
See #11951 (comment) - we can avoid null checks when we are sure that the captured continuation's context contained a span.
| } | ||
| } | ||
| return null; | ||
| return null != continuation ? continuation.resume() : null; |
There was a problem hiding this comment.
💭 thought: Is this a behavior change? It only resumes continuation without adding the current context to it.
There was a problem hiding this comment.
simplification - look at what the old code was doing:
if (null != continuation) {
AgentScope agentScope = continuation.activate();
try {
return agentScope.span().attachWithContext();
} finally {
agentScope.close();
}
}
First it activated the continuation - this attached the span from the continuation without merging in the surrounding context (which is correct, you don't want to pick up context that might be hanging around when activating the continuation at this point.)
Then it attached the span from the current scope - which will be same as the continuation's span / context because we just activated it. When attaching it merged in the context from the current active scope, but this will just be the same span again because activating a continuation does not merge it with the surrounding context.
TLDR: it really just needed to activate (or resume) the continuation's context - bonus fix is that we now restore the full context and not just the span.
| ContextContinuation continuation = xchg.getAttachment(DATADOG_UNDERTOW_CONTINUATION); | ||
| if (continuation != null) { | ||
| continuation.span().getRequestContext().getTraceSegment().effectivelyBlocked(); | ||
| AgentSpan.fromContext(continuation.context()) |
There was a problem hiding this comment.
❔ question: Should we have null check here too? It's not supposed to be null but I wonder if it could bite us later 🤔
There was a problem hiding this comment.
As we move away from AgentScope this question will come up. Basically I don't want to litter the codebase with null-checks.
For this specific PR we know the context captured in the continuation was a span (or included a span) so we know this will not be null on the other side. For this kind of situation - where we know what we put in and therefore know what we'll get out, we can avoid the check. Similarly for enter/exit advice where we know the scope passed to the exit advice has the same context as the enter advice, and we know that had a span.
In a separate PR I'm looking at introducing an "invalid" span like OTel to avoid widespread null-checks, but need to see how that plays out.
…gent-scope-continuation-1-migrate-call-sites
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 26e6e314a8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR deprecates the bridging AgentScope.Continuation type and migrates internal agent/core/instrumentation call sites to use the modern datadog.context.ContextContinuation / ContextScope APIs directly, while keeping legacy compatibility where required.
Changes:
- Deprecate
AgentScope.Continuationand remove its default bridging methods toContextContinuation. - Update tracer/collector APIs and core scope manager/continuation implementations to use
ContextContinuation(activate()→resume(),cancel()→release()). - Mechanically migrate a large set of instrumentations and tests to the new continuation/scope types.
Reviewed changes
Copilot reviewed 103 out of 103 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/NoopScope.java | Adjust noop scope capture signature to TraceScope.Continuation and add deprecation suppression. |
| internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/NoopContinuation.java | Extend noop continuation to satisfy ContextContinuation (resume/context/release). |
| internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/java/lang/ProcessImplInstrumentationHelpers.java | Switch async propagation handling to ContextContinuation and resume(). |
| internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTracer.java | Update capture APIs to return ContextContinuation; update noop collector signatures. |
| internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentTraceCollector.java | Migrate collector contract to ContextContinuation. |
| internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentScope.java | Deprecate AgentScope.Continuation bridging interface and remove default bridge methods. |
| dd-trace-core/src/test/java/datadog/trace/core/scopemanager/ScopeManagerForkedTest.java | Update tests to use ContextContinuation / ContextScope (resume/release). |
| dd-trace-core/src/test/java/datadog/trace/core/PendingTraceStrictWriteTest.java | Update pending-trace tests for release() semantics. |
| dd-trace-core/src/test/java/datadog/trace/core/PendingTraceBufferTest.java | Update buffer tests to store ContextContinuation and activate via ContextScope. |
| dd-trace-core/src/main/java/datadog/trace/core/StreamingTraceCollector.java | Align no-op collector methods with ContextContinuation. |
| dd-trace-core/src/main/java/datadog/trace/core/scopemanager/ScopeContinuation.java | Implement ContextContinuation contract (resume/context/release) while retaining legacy methods. |
| dd-trace-core/src/main/java/datadog/trace/core/scopemanager/ContinuableScopeManager.java | Return ContextContinuation from captureSpan; keep deprecated internal bridging where needed. |
| dd-trace-core/src/main/java/datadog/trace/core/PendingTrace.java | Update continuation reference tracking to accept ContextContinuation. |
| dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java | Update tracer implementation to return ContextContinuation from captureSpan. |
| dd-java-agent/instrumentation/zio/zio-2.0/src/main/java/datadog/trace/instrumentation/zio/v2_0/FiberContext.java | Use ContextContinuation and call release() on end. |
| dd-java-agent/instrumentation/vertx/vertx-sql-client-3.9/src/main/java/datadog/trace/instrumentation/vertx_sql_client_39/QueryResultHandlerWrapper.java | Use ContextContinuation/ContextScope and resume(). |
| dd-java-agent/instrumentation/vertx/vertx-sql-client-3.9/src/main/java/datadog/trace/instrumentation/vertx_sql_client_39/QueryAdvice.java | Capture parent continuation as ContextContinuation. |
| dd-java-agent/instrumentation/vertx/vertx-sql-client-3.9/src/main/java/datadog/trace/instrumentation/vertx_sql_client_39/CursorReadAdvice.java | Capture parent continuation as ContextContinuation. |
| dd-java-agent/instrumentation/vertx/vertx-redis-client/vertx-redis-client-3.9/src/main/java/datadog/trace/instrumentation/vertx_redis_client/ResponseHandlerWrapper.java | Use ContextContinuation/ContextScope and resume(). |
| dd-java-agent/instrumentation/vertx/vertx-redis-client/vertx-redis-client-3.9/src/main/java/datadog/trace/instrumentation/vertx_redis_client/ResponseHandler.java | Use ContextContinuation/ContextScope and resume(). |
| dd-java-agent/instrumentation/vertx/vertx-redis-client/vertx-redis-client-3.9/src/main/java/datadog/trace/instrumentation/vertx_redis_client/RedisSendAdvice.java | Capture parent continuation as ContextContinuation. |
| dd-java-agent/instrumentation/vertx/vertx-redis-client/vertx-redis-client-3.9/src/main/java/datadog/trace/instrumentation/vertx_redis_client/RedisFutureSendAdvice.java | Update advice locals to store ContextContinuation. |
| dd-java-agent/instrumentation/vertx/vertx-redis-client/vertx-redis-client-3.9/src/main/java/datadog/trace/instrumentation/vertx_redis_client/RedisAPICallAdvice.java | Capture parent continuation as ContextContinuation. |
| dd-java-agent/instrumentation/undertow/undertow-common/src/main/java/datadog/trace/instrumentation/undertow/UndertowDecorator.java | Change Undertow attachment key type to ContextContinuation. |
| dd-java-agent/instrumentation/undertow/undertow-common/src/main/java/datadog/trace/instrumentation/undertow/UndertowBlockingHandler.java | Read span via continuation.context() and AgentSpan.fromContext(...). |
| dd-java-agent/instrumentation/undertow/undertow-2.2/src/main/java/datadog/trace/instrumentation/undertow/JakartaServletInstrumentation.java | Use ContextContinuation and extract span from context. |
| dd-java-agent/instrumentation/undertow/undertow-2.0/src/main/java/datadog/trace/instrumentation/undertow/UndertowRunnableWrapper.java | Store/capture ContextContinuation and activate via resume(). |
| dd-java-agent/instrumentation/undertow/undertow-2.0/src/main/java/datadog/trace/instrumentation/undertow/ServletInstrumentation.java | Use ContextContinuation and extract span from context. |
| dd-java-agent/instrumentation/undertow/undertow-2.0/src/main/java/datadog/trace/instrumentation/undertow/HttpServerExchangeSenderInstrumentation.java | Use ContextContinuation and extract span from context. |
| dd-java-agent/instrumentation/undertow/undertow-2.0/src/main/java/datadog/trace/instrumentation/undertow/HandlerInstrumentation.java | Attach via continuation.context().attach() rather than span-only attach. |
| dd-java-agent/instrumentation/undertow/undertow-2.0/src/main/java/datadog/trace/instrumentation/undertow/ExchangeEndSpanListener.java | Release continuation via release(). |
| dd-java-agent/instrumentation/synapse-3.0/src/main/java/datadog/trace/instrumentation/synapse3/SynapseServerWorkerInstrumentation.java | Store/retrieve ContextContinuation and resume directly. |
| dd-java-agent/instrumentation/synapse-3.0/src/main/java/datadog/trace/instrumentation/synapse3/SynapseClientWorkerInstrumentation.java | Store/retrieve ContextContinuation and resume directly. |
| dd-java-agent/instrumentation/spring/spring-scheduling-3.1/src/main/java/datadog/trace/instrumentation/springscheduling/SpannedMethodInvocation.java | Use ContextContinuation and resume() during invocation. |
| dd-java-agent/instrumentation/spring/spring-rabbit-1.5/src/main/java/datadog/trace/instrumentation/springamqp/AbstractMessageListenerContainerInstrumentation.java | Resume continuation using ContextScope. |
| dd-java-agent/instrumentation/slick-3.2/src/main/java/datadog/trace/instrumentation/slick/SlickRunnableInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/servicetalk/servicetalk-0.42.56/src/test/groovy/ContextPreservingInstrumentationTest.groovy | Tests updated to ContextContinuation + release(). |
| dd-java-agent/instrumentation/servicetalk/servicetalk-0.42.0/src/test/groovy/ContextPreservingInstrumentationTest.groovy | Tests updated to ContextContinuation + release(). |
| dd-java-agent/instrumentation/scala/scala-promise/scala-promise-common/src/main/java/datadog/trace/instrumentation/scala/PromiseHelper.java | Update helper return types to ContextScope and continuations to ContextContinuation. |
| dd-java-agent/instrumentation/scala/scala-promise/scala-promise-2.13/src/main/java/datadog/trace/instrumentation/scala213/concurrent/PromiseTransformationInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/scala/scala-promise/scala-promise-2.10/src/main/java/datadog/trace/instrumentation/scala210/concurrent/CallbackRunnableInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/scala/scala-concurrent-2.8/src/main/java/datadog/trace/instrumentation/scala/concurrent/ScalaForkJoinTaskInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/redisson/redisson-3.10.3/src/main/java/datadog/trace/instrumentation/redisson30/SpanFinishListener.java | Resume via ContextScope and finish span from context. |
| dd-java-agent/instrumentation/redisson/redisson-2.3.0/src/main/java/datadog/trace/instrumentation/redisson23/SpanFinishListener.java | Resume via ContextScope and finish span from context. |
| dd-java-agent/instrumentation/redisson/redisson-2.0.0/src/main/java/datadog/trace/instrumentation/redisson/SpanFinishListener.java | Resume via ContextScope and finish span from context. |
| dd-java-agent/instrumentation/reactor-netty-1.0/src/main/java/datadog/trace/instrumentation/reactor/netty/TransferConnectSpan.java | Store ContextContinuation and release() any replaced continuation. |
| dd-java-agent/instrumentation/play-ws/play-ws-2.1/src/main/java/datadog/trace/instrumentation/playws21/AsyncHandlerWrapper.java | Use ContextContinuation and resume() on callbacks. |
| dd-java-agent/instrumentation/play-ws/play-ws-2.0/src/main/java/datadog/trace/instrumentation/playws2/AsyncHandlerWrapper.java | Use ContextContinuation and resume() on callbacks. |
| dd-java-agent/instrumentation/play-ws/play-ws-1.0/src/main/java/datadog/trace/instrumentation/playws1/AsyncHandlerWrapper.java | Use ContextContinuation and resume() on callbacks. |
| dd-java-agent/instrumentation/pekko/pekko-concurrent-1.0/src/main/java/datadog/trace/instrumentation/pekko/concurrent/PekkoRoutedActorCellInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/pekko/pekko-concurrent-1.0/src/main/java/datadog/trace/instrumentation/pekko/concurrent/PekkoForkJoinExecutorTaskInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/pekko/pekko-concurrent-1.0/src/main/java/datadog/trace/instrumentation/pekko/concurrent/PekkoActorCellInstrumentation.java | Use ContextScope for local scope variables. |
| dd-java-agent/instrumentation/opensearch/opensearch-transport-1.0/src/main/java/datadog/trace/instrumentation/opensearch/ThreadedActionListenerInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/netty/netty-promise-4.0/src/main/java/datadog/trace/instrumentation/netty4/promise/ListenerWrapper.java | Use ContextContinuation and attach full context for progressive callbacks. |
| dd-java-agent/instrumentation/netty/netty-common/src/main/java/datadog/trace/instrumentation/netty41/AttributeKeys.java | Change connect-parent attribute key to ContextContinuation. |
| dd-java-agent/instrumentation/netty/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/NettyChannelPipelineInstrumentation.java | Capture/store ContextContinuation for connect parent and release() on failure. |
| dd-java-agent/instrumentation/netty/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/Http2ConnectContinuationListener.java | Release stored connect continuation via release(). |
| dd-java-agent/instrumentation/netty/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/client/HttpClientRequestTracingHandler.java | Resume connect-parent continuation via resume(). |
| dd-java-agent/instrumentation/netty/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/ChannelFutureListenerInstrumentation.java | Use ContextContinuation/ContextScope and resume(). |
| dd-java-agent/instrumentation/netty/netty-4.0/src/main/java/datadog/trace/instrumentation/netty40/NettyChannelPipelineInstrumentation.java | Capture/store ContextContinuation for connect parent and release() on failure. |
| dd-java-agent/instrumentation/netty/netty-4.0/src/main/java/datadog/trace/instrumentation/netty40/client/HttpClientRequestTracingHandler.java | Resume connect-parent continuation via resume(). |
| dd-java-agent/instrumentation/netty/netty-4.0/src/main/java/datadog/trace/instrumentation/netty40/ChannelFutureListenerInstrumentation.java | Use ContextContinuation/ContextScope and resume(). |
| dd-java-agent/instrumentation/netty/netty-4.0/src/main/java/datadog/trace/instrumentation/netty40/AttributeKeys.java | Change connect-parent attribute key to ContextContinuation. |
| dd-java-agent/instrumentation/netty/netty-3.8/src/main/java/datadog/trace/instrumentation/netty38/NettyChannelInstrumentation.java | Capture/store ContextContinuation and release() duplicates. |
| dd-java-agent/instrumentation/netty/netty-3.8/src/main/java/datadog/trace/instrumentation/netty38/client/HttpClientRequestTracingHandler.java | Resume connection continuation via resume(). |
| dd-java-agent/instrumentation/netty/netty-3.8/src/main/java/datadog/trace/instrumentation/netty38/ChannelTraceContext.java | Store connection continuation as ContextContinuation. |
| dd-java-agent/instrumentation/netty/netty-3.8/src/main/java/datadog/trace/instrumentation/netty38/ChannelFutureListenerInstrumentation.java | Use ContextContinuation/ContextScope and resume(). |
| dd-java-agent/instrumentation/mongo/mongo-driver/mongo-driver-4.0/src/main/java/datadog/trace/instrumentation/mongo/CallbackWrapper.java | Swap continuation field/updater to ContextContinuation and resume/release. |
| dd-java-agent/instrumentation/lettuce/lettuce-5.0/src/main/java/datadog/trace/instrumentation/lettuce5/CommandHandlerInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/lettuce/lettuce-5.0/src/main/java/datadog/trace/instrumentation/lettuce5/AsyncCommandInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/kotlin-coroutines-1.3/src/main/java/datadog/trace/instrumentation/kotlin/coroutines/DatadogThreadContextElement.java | Store ContextContinuation and call release() on coroutine completion. |
| dd-java-agent/instrumentation/jetty/jetty-server/jetty-server-12.0/src/main/java17/datadog/trace/instrumentation/jetty12/JettyRunnableWrapper.java | Capture/store ContextContinuation and activate via resume(). |
| dd-java-agent/instrumentation/java/java-net/java-net-11.0/src/main/java11/datadog/trace/instrumentation/httpclient/CompletableFutureWrapper.java | Accept ContextContinuation and resume it before completing. |
| dd-java-agent/instrumentation/java/java-net/java-net-11.0/src/main/java11/datadog/trace/instrumentation/httpclient/BodyHandlerWrapper.java | Wrap body subscriber using ContextContinuation and resume(). |
| dd-java-agent/instrumentation/java/java-lang/java-lang-21.0/src/main/java/datadog/trace/instrumentation/java/lang/jdk21/VirtualThreadInstrumentation.java | Update docs/imports to refer to ContextContinuation. |
| dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-21.0/src/main/java/datadog/trace/instrumentation/java/concurrent/virtualthread/TaskRunnerInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/main/java/java/util/concurrent/CompletableFutureAdvice.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/main/java/datadog/trace/instrumentation/java/concurrent/runnable/RunnableInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/main/java/datadog/trace/instrumentation/java/concurrent/runnable/RunnableFutureInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/main/java/datadog/trace/instrumentation/java/concurrent/runnable/ConsumerTaskInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/main/java/datadog/trace/instrumentation/java/concurrent/forkjoin/JavaForkJoinTaskInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/main/java/datadog/trace/instrumentation/java/concurrent/executor/ThreadPoolExecutorInstrumentation.java | Update advice enter/exit types to ContextScope for TPE propagation. |
| dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/main/java/datadog/trace/instrumentation/java/completablefuture/AsyncTaskInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/grpc-1.5/src/main/java/datadog/trace/instrumentation/grpc/QueuedCommandInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/elasticsearch/elasticsearch-transport/elasticsearch-transport-common/src/main/java/datadog/trace/instrumentation/elasticsearch/ThreadedActionListenerInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/axis2-1.3/src/main/java/datadog/trace/instrumentation/axis2/AxisEngineInstrumentation.java | Resume only when stored object is a ContextContinuation. |
| dd-java-agent/instrumentation/apache-httpclient/apache-httpclient-5.0/src/main/java/datadog/trace/instrumentation/apachehttpclient5/TraceContinuedFutureCallback.java | Use ContextContinuation and resume() for callback execution. |
| dd-java-agent/instrumentation/apache-httpclient/apache-httpclient-5.0/src/main/java/datadog/trace/instrumentation/apachehttpclient5/ApacheHttpAsyncClientInstrumentation.java | Capture parent continuation as ContextContinuation. |
| dd-java-agent/instrumentation/apache-httpclient/apache-httpasyncclient-4.0/src/main/java/datadog/trace/instrumentation/apachehttpasyncclient/TraceContinuedFutureCallback.java | Use ContextContinuation and resume() for callback execution. |
| dd-java-agent/instrumentation/apache-httpclient/apache-httpasyncclient-4.0/src/main/java/datadog/trace/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientInstrumentation.java | Capture parent continuation as ContextContinuation. |
| dd-java-agent/instrumentation/akka/akka-actor-2.5/src/main/java/datadog/trace/instrumentation/akka/concurrent/AkkaRoutedActorCellInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/akka/akka-actor-2.5/src/main/java/datadog/trace/instrumentation/akka/concurrent/AkkaForkJoinTaskInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/akka/akka-actor-2.5/src/main/java/datadog/trace/instrumentation/akka/concurrent/AkkaForkJoinExecutorTaskInstrumentation.java | Advice enters/exits now use ContextScope. |
| dd-java-agent/instrumentation/akka/akka-actor-2.5/src/main/java/datadog/trace/instrumentation/akka/concurrent/AkkaActorCellInstrumentation.java | Use ContextScope for local scope variables. |
| dd-java-agent/instrumentation/aerospike-4.0/src/main/java/datadog/trace/instrumentation/aerospike4/TracingListener.java | Use ContextContinuation and resume()/release() around callbacks. |
| dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/lang/VirtualThreadState.java | Store ContextContinuation and release() at termination. |
| dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/Wrapper.java | Capture/store ContextContinuation, resume via ContextScope, and release() on cancel. |
| dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/TPEHelper.java | Replace AgentScope thread-local storage with ContextScope. |
| dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/State.java | Store ContextContinuation and use context() to derive spans. |
| dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/ContinuationClaim.java | Sentinel now implements ContextContinuation with resume/release methods. |
| dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/ConcurrentState.java | Swap internal continuation and scope handling to ContextContinuation/ContextScope. |
| dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/ComparableRunnable.java | Wrapper now accepts ContextContinuation. |
| dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/AdviceUtils.java | Start/end task scope now operate on ContextContinuation/ContextScope. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2fa959d to
e9dfd3d
Compare
What Does This Do
AgentScope.Continuationas@Deprecated— it was a bridging interface extending bothTraceScope.Continuation(public API) andContextContinuation(modern context API).AgentTraceCollector.register/removeContinuationnow acceptContextContinuation.AgentTracer.captureActiveSpan()/captureSpan()static methods returnContextContinuation(implementations still returnAgentScope.Continuationfor Tracer interface compat).ScopeContinuationgainsresume()/release()to satisfy theContextContinuationcontract.State,ConcurrentState,Wrapper,VirtualThreadState,AdviceUtils,TPEHelpermigrated fromAgentScope.ContinuationtoContextContinuation/ContextScope.ContextContinuation,activate()→resume(),Motivation
AgentScope.Continuationmixes a legacy public-API contract with the modern context API, forcing internal code to depend on a bridging type it doesn't need. Moving internal call sites ontoContextContinuationdirectly clears the path to eventually removing the legacy interface, without changing behavior.Additional Notes
This is a mechanical migration with no intended behavior change —
AgentScope.Continuationremains available (deprecated) for public API / Tracer interface compatibility. No release note required.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]