Skip to content

Use context capture controls instead of async propagation methods - #13319

Draft
mcculls wants to merge 1 commit into
mcculls/context-capture-flagfrom
mcculls/context-capture-callers
Draft

mcculls wants to merge 1 commit into
mcculls/context-capture-flagfrom
mcculls/context-capture-callers

Conversation

@mcculls

@mcculls mcculls commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Move remaining capture-control callers to Context.isCaptureEnabled / Context.setCaptureEnabled and remove the static async-propagation wrappers from AgentTracer. Public tracer instance methods remain available for compatibility.

Motivation

Capture suppression belongs to the active execution context. Using the Context API lets callers follow the selected context manager without depending on the legacy tracer API. This is stacked on #13311.

Additional Notes

Reroute the legacy adapter's capture methods to the scope manager through dedicated tracer capture methods, bypassing the public async-propagation methods. Advice uses the bytecode bridge for compatibility with older class files.

Validation: scope-manager and AI Guard propagation tests; all three migrated OpenTracing test classes; compilation of migrated Scala and Kotlin callers; formatting of affected modules. Scope-manager tests also check legacy API compatibility and verify Context bypasses the legacy async methods.

@mcculls mcculls added tag: no release notes Changes to exclude from release notes type: refactoring comp: context propagation Trace context propagation tag: ai generated Largely based on code generated by an AI or LLM labels Nov 9, 2026
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 40.38% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: fcaeeeb | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Nov 9, 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 14.06 s 13.93 s [+0.1%; +1.7%] (maybe worse)
startup:insecure-bank:tracing:Agent 12.96 s 12.99 s [-0.8%; +0.4%] (no difference)
startup:petclinic:appsec:Agent 17.22 s 17.14 s [-0.3%; +1.3%] (no difference)
startup:petclinic:iast:Agent 17.07 s 17.13 s [-1.2%; +0.4%] (no difference)
startup:petclinic:profiling:Agent 16.64 s 16.74 s [-1.5%; +0.3%] (no difference)
startup:petclinic:sca:Agent 17.13 s 16.99 s [-0.1%; +1.8%] (no difference)
startup:petclinic:tracing:Agent 16.26 s 16.31 s [-1.2%; +0.6%] (no difference)

Commit: 87b69611 · 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.

@mcculls
mcculls force-pushed the mcculls/context-capture-callers branch from b0410db to 9c1c1c7 Compare November 11, 2026 11:50
@pr-commenter

pr-commenter Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch mcculls/context-capture-flag mcculls/context-capture-callers
git_commit_date 1794779638 1794779723
git_commit_sha 34527ff 87b6961
See matching parameters
Baseline Candidate
ci_job_date 1794781148 1794781148
ci_job_id 2255929538 2255929538
ci_pipeline_id 153369330 153369330
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.31 11.0.31
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 -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=15002 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=15002 -Dhttp.nonProxyHosts=localhost *.localhost
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-h7v83v51 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-h7v83v51 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 1 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 unstable
[-10844.661op/s; +4106.927op/s] or [-8.233%; +3.118%]

@pr-commenter

pr-commenter Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch mcculls/context-capture-flag mcculls/context-capture-callers
git_commit_date 1794779638 1794779723
git_commit_sha 34527ff 87b6961
See matching parameters
Baseline Candidate
ci_job_date 1794781070 1794781070
ci_job_id 2255929541 2255929541
ci_pipeline_id 153369330 153369330
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.31 11.0.31
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 -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=15002 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=15002 -Dhttp.nonProxyHosts=localhost *.localhost
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-ayh6ttef 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-ayh6ttef 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu

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 unsure
[+262.753op/s; +11880.922op/s] or [+0.089%; +4.027%]
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsume same

@mcculls
mcculls force-pushed the mcculls/context-capture-callers branch from 9c1c1c7 to ad1d74c Compare November 12, 2026 12:21
@mcculls
mcculls added this pull request to stack #13397 November 12, 2026 12:21
@pr-commenter

pr-commenter Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1794780682 1794781009
end_time 2026-11-15T22:12:53 2026-11-15T22:18:20
git_branch master mcculls/context-capture-callers
git_commit_sha e8e4235 87b6961
start_time 2026-11-15T22:11:23 2026-11-15T22:16:50
See matching parameters
Baseline Candidate
ci_job_id 2255929543 2255929543
ci_pipeline_id 153369330 153369330
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
git_commit_date 1794779723 1794779723

Summary

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

scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:basic worse
[+9.958µs; +23.715µs] or [+3.080%; +7.334%]
worse
[+11.079µs; +23.817µs] or [+3.184%; +6.844%]
worse
[+11.683µs; +23.490µs] or [+3.269%; +6.574%]
unstable
[-161.833µs; +111.082µs] or [-17.149%; +11.771%]
unsure
[-188.344op/s; -0.781op/s] or [-8.475%; -0.035%]
See unchanged results
scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:noprobe unstable
[-16.304µs; +30.184µs] or [-4.914%; +9.098%]
unstable
[-24.951µs; +40.725µs] or [-6.867%; +11.209%]
unstable
[-32.916µs; +50.750µs] or [-8.733%; +13.464%]
unstable
[+6.292µs; +204.942µs] or [+0.591%; +19.260%]
same
scenario:loop same same same same same
Request duration reports for reports
gantt
    title reports - request duration [CI 0.99] : candidate=None, baseline=None
    dateFormat X
    axisFormat %s
section baseline
noprobe (363.33 µs) : 340, 386
.   : milestone, 363,
basic (347.973 µs) : 343, 353
.   : milestone, 348,
loop (8.124 ms) : 8060, 8188
.   : milestone, 8124,
section candidate
noprobe (371.217 µs) : 334, 409
.   : milestone, 371,
basic (365.421 µs) : 358, 372
.   : milestone, 365,
loop (8.12 ms) : 8056, 8184
.   : milestone, 8120,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 363.33 µs [340.207 µs, 386.453 µs]
basic 347.973 µs [342.84 µs, 353.105 µs]
loop 8.124 ms [8.06 ms, 8.188 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 371.217 µs [333.677 µs, 408.757 µs]
basic 365.421 µs [358.35 µs, 372.492 µs]
loop 8.12 ms [8.056 ms, 8.184 ms]

@mcculls
mcculls force-pushed the mcculls/context-capture-callers branch from ad1d74c to a930c41 Compare November 12, 2026 12:57
@mcculls
mcculls force-pushed the mcculls/context-capture-callers branch 2 times, most recently from 9964b50 to 20d70b5 Compare November 14, 2026 20:18
@mcculls
mcculls force-pushed the mcculls/context-capture-callers branch 2 times, most recently from c85b231 to 87b6961 Compare November 15, 2026 21:59
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot force-pushed the mcculls/context-capture-callers branch from 87b6961 to 9721043 Compare November 16, 2026 16:59
Capture suppression belongs to the active execution context rather than
its tracer. Move instrumentation helpers and tests to the Context capture
controls so they follow the selected context manager.
@mcculls
mcculls force-pushed the mcculls/context-capture-callers branch from 9721043 to fcaeeeb Compare November 16, 2026 23:56

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: context propagation Trace context propagation 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