Skip to content

Reset async propagation when attaching agent-managed contexts - #13310

Open
mcculls wants to merge 1 commit into
mcculls/legacy-propagation-queryfrom
mcculls/context-attach-reset-async
Open

mcculls wants to merge 1 commit into
mcculls/legacy-propagation-queryfrom
mcculls/context-attach-reset-async

Conversation

@mcculls

@mcculls mcculls commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

New context attachments in the legacy scope manager use the default async propagation setting, matching activateSpan. Re-attaching the current context preserves its existing setting. OpenTelemetry manual attachments continue to inherit disabled propagation from the active scope.

Motivation

Agent-managed instrumentation should start new work with the default propagation setting. Manual tracing APIs should preserve a surrounding scope's disabled propagation so that manual scope management cannot inadvertently re-enable it.

Additional Notes

Stacked on #13305, which makes the propagation query return the default when no scope is active. The OTel shim preserves manual inheritance without adding another attachment method to the context API.

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

This comment has been minimized.

@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.03 s 13.95 s [-0.1%; +1.3%] (no difference)
startup:insecure-bank:tracing:Agent 12.96 s 13.00 s [-1.0%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 17.79 s 17.55 s [+0.4%; +2.3%] (maybe worse)
startup:petclinic:iast:Agent 17.57 s 17.65 s [-1.2%; +0.2%] (no difference)
startup:petclinic:profiling:Agent 17.23 s 17.26 s [-1.3%; +1.0%] (no difference)
startup:petclinic:sca:Agent 17.79 s 17.62 s [-0.0%; +1.9%] (no difference)
startup:petclinic:tracing:Agent 16.67 s 16.77 s [-1.6%; +0.3%] (no difference)

Commit: 71cc64b6 · 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 Nov 12, 2026

Copy link
Copy Markdown

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1794486570 1794486896
end_time 2026-11-12T12:30:57 2026-11-12T12:36:24
git_branch master mcculls/context-attach-reset-async
git_commit_sha 4591fbc 71cc64b
start_time 2026-11-12T12:29:31 2026-11-12T12:34:57
See matching parameters
Baseline Candidate
ci_job_id 2243881166 2243881166
ci_pipeline_id 152546091 152546091
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
git_commit_date 1794485790 1794485790

Summary

Found 5 performance improvements and 0 performance regressions! Performance is the same for 5 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:loop better
[-566.170µs; -470.980µs] or [-7.051%; -5.865%]
better
[-569.389µs; -473.061µs] or [-7.039%; -5.848%]
better
[-574.542µs; -476.088µs] or [-7.069%; -5.858%]
better
[-593.647µs; -404.956µs] or [-7.220%; -4.925%]
better
[+6.155op/s; +9.682op/s] or [+5.047%; +7.940%]
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
[-28.793µs; +39.951µs] or [-9.064%; +12.576%]
unstable
[-40.593µs; +53.302µs] or [-11.589%; +15.218%]
unstable
[-49.556µs; +63.555µs] or [-13.594%; +17.434%]
unstable
[-80.683µs; +180.067µs] or [-6.756%; +15.078%]
same
scenario:basic same unsure
[-12.742µs; -1.951µs] or [-3.875%; -0.593%]
unsure
[-12.682µs; -2.244µs] or [-3.753%; -0.664%]
unstable
[-90.854µs; +127.218µs] or [-8.672%; +12.143%]
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 (350.255 µs) : 312, 389
.   : milestone, 350,
basic (328.846 µs) : 324, 334
.   : milestone, 329,
loop (8.089 ms) : 8026, 8152
.   : milestone, 8089,
section candidate
noprobe (356.61 µs) : 307, 407
.   : milestone, 357,
basic (321.499 µs) : 316, 327
.   : milestone, 321,
loop (7.568 ms) : 7562, 7575
.   : milestone, 7568,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 350.255 µs [311.88 µs, 388.63 µs]
basic 328.846 µs [323.781 µs, 333.911 µs]
loop 8.089 ms [8.026 ms, 8.152 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 356.61 µs [306.535 µs, 406.684 µs]
basic 321.499 µs [316.067 µs, 326.931 µs]
loop 7.568 ms [7.562 ms, 7.575 ms]

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot force-pushed the mcculls/context-attach-reset-async branch from 71cc64b to 9923dbb Compare November 16, 2026 16:59
New context scopes now use the default async propagation setting,
matching activateSpan. Re-attaching the current context preserves its
existing setting.

Preserve inheritance in the OpenTelemetry shim because makeCurrent()
is a manual tracing API. A manual attachment inside a scope with async
propagation disabled must keep it disabled, including if the application
fails to close the manual scope.

This keeps manual scope management from inadvertently re-enabling async
propagation disabled by instrumentation.
@mcculls
mcculls force-pushed the mcculls/context-attach-reset-async branch from 9923dbb to 801bf5c Compare November 16, 2026 23:56
@mcculls
mcculls marked this pull request as ready for review November 17, 2026 00:08
@mcculls
mcculls requested review from a team as code owners November 17, 2026 00:08
@mcculls
mcculls requested review from ValentinZakharov, genesor and jpbempel and removed request for a team November 17, 2026 00:08
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-17T00:08:37.655839Z 801bf5c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mcculls
mcculls requested a review from amarziali November 17, 2026 00:09

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: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant