Skip to content

Deprecate AgentScope.Continuation and migrate call sites to ContextContinuation#11951

Open
mcculls wants to merge 6 commits into
masterfrom
mcculls/deprecate-agent-scope-continuation-1-migrate-call-sites
Open

Deprecate AgentScope.Continuation and migrate call sites to ContextContinuation#11951
mcculls wants to merge 6 commits into
masterfrom
mcculls/deprecate-agent-scope-continuation-1-migrate-call-sites

Conversation

@mcculls

@mcculls mcculls commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

  • Marks AgentScope.Continuation as @Deprecated — it was a bridging interface extending both TraceScope.Continuation (public API) and ContextContinuation (modern context API).
  • Migrates internal call sites to use ContextContinuation directly:
    • 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() to satisfy the ContextContinuation contract.
    • State, ConcurrentState, Wrapper, VirtualThreadState, AdviceUtils, TPEHelper migrated from AgentScope.Continuation to ContextContinuation/ContextScope.
    • ~85 instrumentation files updated: field types switched to ContextContinuation, activate()resume(),

Motivation

AgentScope.Continuation mixes 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 onto ContextContinuation directly 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.Continuation remains available (deprecated) for public API / Tracer interface compatibility. No release note required.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@mcculls
mcculls requested review from a team as code owners July 15, 2026 00:33
@mcculls mcculls added the comp: core Tracer core label Jul 15, 2026
@mcculls
mcculls requested review from a team as code owners July 15, 2026 00:33
@mcculls mcculls added tag: no release notes Changes to exclude from release notes type: refactoring labels Jul 15, 2026
@mcculls
mcculls requested review from PerfectSlayer, ValentinZakharov and mtoffl01 and removed request for a team July 15, 2026 00:33
@mcculls
mcculls marked this pull request as draft July 15, 2026 00:33
@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label Jul 15, 2026
@datadog-datadog-prod-us1

This comment has been minimized.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java Outdated

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

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).

Was this helpful? React 👍 or 👎

📊 Validated against 23 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 4041cbe · What is Autotest? · Any feedback? Reach out in #autotest

@dd-octo-sts

dd-octo-sts Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.92 s 13.84 s [-0.0%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 12.93 s 12.95 s [-0.7%; +0.4%] (no difference)
startup:petclinic:appsec:Agent 16.89 s 16.63 s [+0.4%; +2.7%] (maybe worse)
startup:petclinic:iast:Agent 16.95 s 16.95 s [-0.9%; +0.9%] (no difference)
startup:petclinic:profiling:Agent 16.73 s 16.37 s [-2.5%; +6.9%] (no difference)
startup:petclinic:sca:Agent 16.86 s 16.78 s [-0.4%; +1.4%] (no difference)
startup:petclinic:tracing:Agent 16.05 s 16.00 s [-0.9%; +1.6%] (no difference)

Commit: e9dfd3db · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@pr-commenter

pr-commenter Bot commented Jul 15, 2026

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/deprecate-agent-scope-continuation-1-migrate-call-sites
git_commit_date 1784055714 1784112711
git_commit_sha fbd28da ed5b5ef
See matching parameters
Baseline Candidate
ci_job_date 1784113732 1784113732
ci_job_id 1860686149 1860686149
ci_pipeline_id 124717179 124717179
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.25 11.0.25
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/consumer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/consumer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.25+9-post-Ubuntu-1ubuntu122.04 11.0.25+9-post-Ubuntu-1ubuntu122.04

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsume same

@mcculls
mcculls force-pushed the mcculls/deprecate-agent-scope-continuation-1-migrate-call-sites branch 3 times, most recently from 09dab12 to ed5b5ef Compare July 15, 2026 10:52
@mcculls
mcculls marked this pull request as ready for review July 15, 2026 10:57
datadog-datadog-prod-us1[bot]

This comment was marked as outdated.

@pr-commenter

pr-commenter Bot commented Jul 15, 2026

Copy link
Copy Markdown

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/deprecate-agent-scope-continuation-1-migrate-call-sites
git_commit_date 1784055714 1784112711
git_commit_sha fbd28da ed5b5ef
See matching parameters
Baseline Candidate
ci_job_date 1784113692 1784113692
ci_job_id 1860686148 1860686148
ci_pipeline_id 124717179 124717179
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.25 11.0.25
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/producer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/producer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.25+9-post-Ubuntu-1ubuntu122.04 11.0.25+9-post-Ubuntu-1ubuntu122.04

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaProduceBenchmark.benchProduce unsure
[-5959.868op/s; -84.430op/s] or [-4.099%; -0.058%]

@mcculls
mcculls force-pushed the mcculls/deprecate-agent-scope-continuation-1-migrate-call-sites branch 3 times, most recently from 55ebf56 to f26db87 Compare July 15, 2026 23:01
…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>
@mcculls
mcculls force-pushed the mcculls/deprecate-agent-scope-continuation-1-migrate-call-sites branch from f26db87 to 7ddef31 Compare July 16, 2026 09:31
@mcculls
mcculls requested a review from amarziali July 16, 2026 12:00

@PerfectSlayer PerfectSlayer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 thought: ‏Should we handle null span here?

@mcculls mcculls Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ question: ‏Same question about null span here too

@mcculls mcculls Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 thought: Is this a behavior change? It only resumes continuation without adding the current context‏ to it.

@mcculls mcculls Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ question: ‏Should we have null check here too? It's not supposed to be null but I wonder if it could bite us later 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mcculls

mcculls commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Continuation and remove its default bridging methods to ContextContinuation.
  • 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.

@mcculls
mcculls force-pushed the mcculls/deprecate-agent-scope-continuation-1-migrate-call-sites branch from 2fa959d to e9dfd3d Compare July 17, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants