Skip to content

Rename AgentSpan.context() to AgentSpan.spanContext() to disambiguate it from generic context#11707

Open
mcculls wants to merge 4 commits into
masterfrom
mcculls/disambiguate-agent-span-context
Open

Rename AgentSpan.context() to AgentSpan.spanContext() to disambiguate it from generic context#11707
mcculls wants to merge 4 commits into
masterfrom
mcculls/disambiguate-agent-span-context

Conversation

@mcculls

@mcculls mcculls commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Motivation

spanContext() more accurately describes what it returns, which is a SpanContext

AgentSpan is an internal API so this is not a breaking change for external users.

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)
    • Get more information in this doc

Jira ticket: [PROJ-IDENT]

@mcculls mcculls added comp: core Tracer core tag: no release notes Changes to exclude from release notes type: refactoring labels Jun 23, 2026
@mcculls mcculls requested review from a team as code owners June 23, 2026 11:15
@mcculls mcculls requested review from PerfectSlayer, amarziali, daniel-romano-DD, jandro996, mtoffl01, tylfin and ygree and removed request for a team June 23, 2026 11:15

@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: c2b4698ede

ℹ️ 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".

@datadog-prod-us1-3 datadog-prod-us1-3 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.

Datadog Autotest: PASS

More details

The rename is complete and fully consistent across all 142 changed files. A comprehensive grep across the entire repo found zero remaining callers of the old AgentSpan.context() signature in production source. The key disambiguation — AgentScope.context() returns Context (the framework context object) while AgentSpan.spanContext() returns AgentSpanContext (the tracing span context) — is preserved correctly, and the OpenTracing public API Span.context() is untouched.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit c2b4698 · What is Autotest? · @autotest to ask questions · Any feedback? Reach out in #autotest

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

Make sense. Should we rename some of the variable names too? (I added comments for the most of them I think).

💭 thought: ‏At some point, I wonder if we should not rename ExtractedContext to ExtractedSpanContext or RemoteSpanContext.

Comment thread dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java Outdated
Comment thread dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java Outdated
Comment thread dd-trace-core/src/test/java/datadog/trace/core/CoreSpanBuilderTest.java Outdated
Comment thread dd-trace-core/src/test/java/datadog/trace/core/CoreSpanBuilderTest.java Outdated
Comment thread dd-trace-ot/src/main/java/datadog/opentracing/DDTracer.java Outdated
@pr-commenter

pr-commenter Bot commented Jun 23, 2026

Copy link
Copy Markdown

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1782213891 1782214237
end_time 2026-06-23T11:26:16 2026-06-23T11:32:03
git_branch master mcculls/disambiguate-agent-span-context
git_commit_sha e3a0877 c2b4698
start_time 2026-06-23T11:24:52 2026-06-23T11:30:38
See matching parameters
Baseline Candidate
ci_job_id 1795251113 1795251113
ci_pipeline_id 120460203 120460203
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
git_commit_date 1782213127 1782213127

Summary

Found 0 performance improvements and 5 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 worse
[+301.167µs; +479.099µs] or [+3.387%; +5.389%]
worse
[+328.039µs; +511.792µs] or [+3.652%; +5.698%]
worse
[+315.787µs; +496.357µs] or [+3.483%; +5.474%]
worse
[+317.838µs; +509.777µs] or [+3.463%; +5.554%]
worse
[-5.872op/s; -3.381op/s] or [-5.344%; -3.077%]
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
[-14.577µs; +30.127µs] or [-5.028%; +10.392%]
unstable
[-26.080µs; +42.254µs] or [-7.833%; +12.691%]
unstable
[-36.165µs; +53.280µs] or [-10.367%; +15.273%]
unstable
[-48.195µs; +175.741µs] or [-4.098%; +14.942%]
same
scenario:basic same same same unstable
[-16.158µs; +198.449µs] or [-1.528%; +18.768%]
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 (332.954 µs) : 305, 361
.   : milestone, 333,
basic (296.438 µs) : 290, 303
.   : milestone, 296,
loop (8.981 ms) : 8976, 8986
.   : milestone, 8981,
section candidate
noprobe (341.042 µs) : 305, 377
.   : milestone, 341,
basic (298.673 µs) : 291, 306
.   : milestone, 299,
loop (9.401 ms) : 9281, 9522
.   : milestone, 9401,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 332.954 µs [304.993 µs, 360.916 µs]
basic 296.438 µs [289.831 µs, 303.044 µs]
loop 8.981 ms [8.976 ms, 8.986 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 341.042 µs [304.594 µs, 377.489 µs]
basic 298.673 µs [291.22 µs, 306.125 µs]
loop 9.401 ms [9.281 ms, 9.522 ms]

@dd-octo-sts

dd-octo-sts Bot commented Jun 23, 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.95 s 13.99 s [-1.1%; +0.5%] (no difference)
startup:insecure-bank:tracing:Agent 12.90 s 12.96 s [-1.4%; +0.5%] (no difference)
startup:petclinic:appsec:Agent 16.92 s 16.77 s [+0.0%; +1.8%] (maybe worse)
startup:petclinic:iast:Agent 17.00 s 16.95 s [-0.5%; +1.2%] (no difference)
startup:petclinic:profiling:Agent 16.75 s 16.92 s [-2.0%; +0.0%] (no difference)
startup:petclinic:sca:Agent 16.93 s 16.70 s [+0.4%; +2.4%] (maybe worse)
startup:petclinic:tracing:Agent 15.94 s 16.08 s [-2.1%; +0.4%] (no difference)

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

@amarziali amarziali 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.

The renaming sounds reasonable to me

@PerfectSlayer

Copy link
Copy Markdown
Contributor

I must admit reviewing the changes and getting reminded about the actual use for the "span context" is quite depressing. I hove at some point we will succeed in trimming it - so it is no longer the main data model holder for so many features 😓

@pr-commenter

pr-commenter Bot commented Jun 23, 2026

Copy link
Copy Markdown

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/disambiguate-agent-span-context
git_commit_date 1782218169 1782219477
git_commit_sha 635c6b8 6204842
See matching parameters
Baseline Candidate
ci_job_date 1782220568 1782220568
ci_job_id 1795657202 1795657202
ci_pipeline_id 120486777 120486777
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 same

@datadog-prod-us1-3

This comment has been minimized.

@pr-commenter

pr-commenter Bot commented Jun 23, 2026

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/disambiguate-agent-span-context
git_commit_date 1782176664 1782213127
git_commit_sha a723424 c2b4698
See matching parameters
Baseline Candidate
ci_job_date 1782214438 1782214438
ci_job_id 1795251111 1795251111
ci_pipeline_id 120460203 120460203
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/disambiguate-agent-span-context branch 3 times, most recently from a066108 to 1759a57 Compare June 23, 2026 12:33
@mcculls mcculls force-pushed the mcculls/disambiguate-agent-span-context branch from 1759a57 to 281ce7d Compare June 23, 2026 12:39
@mcculls mcculls force-pushed the mcculls/disambiguate-agent-span-context branch from 639f4b3 to b43621b Compare June 23, 2026 12:54
@mcculls mcculls added this pull request to the merge queue Jun 23, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jun 23, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-06-23 13:55:10 UTC ℹ️ Start processing command /merge
Use /merge -c to cancel this operation!


2026-06-23 13:55:17 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).

Use /merge -c to cancel this operation!


⏳ Processing

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core 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.

5 participants