Skip to content

Restore instrumentation contexts without legacy scope APIs - #13454

Draft
mcculls wants to merge 5 commits into
mcculls/remove-deprecated-instrumentation-static-methodsfrom
mcculls/cleanup-unscoped-contexts
Draft

mcculls wants to merge 5 commits into
mcculls/remove-deprecated-instrumentation-static-methodsfrom
mcculls/cleanup-unscoped-contexts

Conversation

@mcculls

@mcculls mcculls commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Restore the previous context after CI Visibility, Karate, and AWS operations when using the non-legacy context manager. Hand Mongo command spans to the command listener without activating them, and warn once when OpenTracing callers attempt to close an active-span view instead of the scope returned by activation.

Motivation

These paths relied on legacy scope activation and closure semantics. Use explicit context restoration for the non-legacy manager while preserving the legacy paths, and remove the static AgentTracer helpers that made those scope operations easy to reuse.

Additional Notes

Regression coverage includes nested and out-of-order CI activations, vetoed Karate steps and cold-start retries, AWS request and async-signing restoration, Mongo pending-span handoff, and OpenTracing active-view closure.

Versioned Karate suites and their forked tests share the same minimum JVM constraints: Java 11 for Karate 1.4.1 and Java 17 for the latest 1.x release. This prevents Java 8 CI from trying to load incompatible Karate classes.

Validated locally: both suites and their forked tasks skip Java 8; Karate 1.4.1's normal and forked tests pass on Java 11; latest Karate's normal and forked tests pass on Java 17. The JVM constraint check and module formatting also pass.

@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 13, 2026
@mcculls
mcculls added this pull request to stack #13397 November 13, 2026 22:47
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🎯 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: f3d5901 | Docs | Give us feedback!

@pr-commenter

pr-commenter Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1794780659 1794780975
end_time 2026-11-15T22:12:27 2026-11-15T22:17:43
git_branch master mcculls/cleanup-unscoped-contexts
git_commit_sha e8e4235 ffe2e21
start_time 2026-11-15T22:11:00 2026-11-15T22:16:16
See matching parameters
Baseline Candidate
ci_job_id 2255929530 2255929530
ci_pipeline_id 153369329 153369329
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
git_commit_date 1794779748 1794779748

Summary

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

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
[-19.750µs; +22.274µs] or [-6.261%; +7.062%]
unstable
[-33288.697ns; +33472.163ns] or [-9.547%; +9.599%]
unstable
[-43079.114ns; +42355.580ns] or [-11.862%; +11.663%]
unstable
[-130.460µs; +68.223µs] or [-11.007%; +5.756%]
same
scenario:basic same same same unstable
[-128.505µs; +119.332µs] or [-11.277%; +10.472%]
unstable
[-123.470op/s; +123.470op/s] or [-5.309%; +5.309%]
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 (348.691 µs) : 317, 381
.   : milestone, 349,
basic (321.812 µs) : 317, 327
.   : milestone, 322,
loop (7.57 ms) : 7564, 7576
.   : milestone, 7570,
section candidate
noprobe (348.782 µs) : 317, 380
.   : milestone, 349,
basic (322.486 µs) : 317, 328
.   : milestone, 322,
loop (7.57 ms) : 7564, 7576
.   : milestone, 7570,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 348.691 µs [316.621 µs, 380.761 µs]
basic 321.812 µs [316.523 µs, 327.101 µs]
loop 7.57 ms [7.564 ms, 7.576 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 348.782 µs [317.426 µs, 380.139 µs]
basic 322.486 µs [317.12 µs, 327.852 µs]
loop 7.57 ms [7.564 ms, 7.576 ms]

@dd-octo-sts

dd-octo-sts Bot commented Nov 13, 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.76 s 14.72 s [-0.7%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 13.52 s 13.67 s [-1.8%; -0.4%] (maybe better)
startup:petclinic:appsec:Agent 17.17 s 17.10 s [-0.5%; +1.4%] (no difference)
startup:petclinic:iast:Agent 16.67 s 17.13 s [-6.9%; +1.5%] (no difference)
startup:petclinic:profiling:Agent 16.79 s 17.10 s [-3.1%; -0.5%] (maybe better)
startup:petclinic:sca:Agent 17.21 s 16.94 s [+0.7%; +2.4%] (maybe worse)
startup:petclinic:tracing:Agent 16.16 s 16.10 s [-0.5%; +1.3%] (no difference)

Commit: ffe2e217 · 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/cleanup-unscoped-contexts branch from 6f92b15 to 065a236 Compare November 14, 2026 20:18
@pr-commenter

pr-commenter Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch mcculls/remove-deprecated-instrumentation-static-methods mcculls/cleanup-unscoped-contexts
git_commit_date 1794779746 1794779748
git_commit_sha 25fb576 ffe2e21
See matching parameters
Baseline Candidate
ci_job_date 1794781180 1794781180
ci_job_id 2255929522 2255929522
ci_pipeline_id 153369329 153369329
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-kygsuo5f 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-kygsuo5f 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/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaProduceBenchmark.benchProduce same

@pr-commenter

pr-commenter Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch mcculls/remove-deprecated-instrumentation-static-methods mcculls/cleanup-unscoped-contexts
git_commit_date 1794779746 1794779748
git_commit_sha 25fb576 ffe2e21
See matching parameters
Baseline Candidate
ci_job_date 1794781197 1794781197
ci_job_id 2255929526 2255929526
ci_pipeline_id 153369329 153369329
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-1-3xax62cg 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-1-3xax62cg 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 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/cleanup-unscoped-contexts branch from 065a236 to 3d8e54f Compare November 15, 2026 14:21
@mcculls
mcculls force-pushed the mcculls/cleanup-unscoped-contexts branch 2 times, most recently from b668a33 to ffe2e21 Compare November 15, 2026 21:59
…sure

Remove the static activateSpanWithoutScope and closeActive helpers and
route callers through TracerAPI. Categorize the retained instance
methods as deprecated scope management supported only in legacy mode.
Save and restore test, suite, and Karate step contexts with context handles.
Keep nested CI activations restorable when they end out of order, clean up
vetoed Karate steps, and preserve cold-start retry instrumentation.

Include context restoration, step veto, and cold-start retry regressions.
Restore AWS SDK v1 request contexts at execution exit and keep SDK v2
legacy scope advice separate from context restoration advice. Preserve
async signing contexts and retain the legacy scope lifecycle.

Include request restoration, async signing, missing-context, and legacy
client regressions.
Use MongoPendingSpan to hand command spans from connection advice to the
command listener without changing the active context. Create a command
span when no pending span is available and inject the helper into all
supported driver instrumentation modules.

Include helper and async DBM handoff regressions for both context managers,
with the corresponding test suite configuration and dependency locks.
Keep ScopeManager.active().close() as an active-span view in non-legacy
mode and warn once that callers must close the scope returned by activate.
Preserve legacy closure and strict-mode checks across both instrumented
OpenTracing versions and the compatibility library.

Include active-view closure regressions for all three implementations.
@mcculls
mcculls force-pushed the mcculls/cleanup-unscoped-contexts branch from ffe2e21 to f3d5901 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