Skip to content

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

Open
mcculls wants to merge 1 commit 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 1 commit 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.98 s 13.94 s [-0.4%; +1.1%] (no difference)
startup:insecure-bank:tracing:Agent 12.90 s 13.08 s [-2.3%; -0.4%] (maybe better)
startup:petclinic:appsec:Agent 16.87 s 16.63 s [+0.6%; +2.3%] (maybe worse)
startup:petclinic:iast:Agent 16.87 s 16.94 s [-1.3%; +0.5%] (no difference)
startup:petclinic:profiling:Agent 16.57 s 16.81 s [-2.8%; -0.1%] (maybe better)
startup:petclinic:sca:Agent 16.88 s 16.69 s [+0.2%; +2.1%] (maybe worse)
startup:petclinic:tracing:Agent 16.10 s 16.24 s [-1.7%; +0.0%] (no difference)

Commit: f26db87f · 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 2 times, most recently from 78879d6 to 55ebf56 Compare July 15, 2026 11:50
…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 55ebf56 to f26db87 Compare July 15, 2026 23:01
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.

1 participant