Skip to content

Comments

refactor(tracer): add checklocks annotations to Span struct#4408

Open
kakkoyun wants to merge 8 commits intomainfrom
kakkoyun/LANGPLAT-434/add_checklocks_for_span
Open

refactor(tracer): add checklocks annotations to Span struct#4408
kakkoyun wants to merge 8 commits intomainfrom
kakkoyun/LANGPLAT-434/add_checklocks_for_span

Conversation

@kakkoyun
Copy link
Member

Add compile-time lock verification annotations to the Span struct,
the most critical data structure in the tracing library.

Signed-off-by: Kemal Akkoyun kemal.akkoyun@datadoghq.com

What does this PR do?

Motivation

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 93.22034% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.42%. Comparing base (4557cb1) to head (5195a97).

Files with missing lines Patch % Lines
ddtrace/tracer/span.go 90.24% 2 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/abandonedspans.go 90.64% <ø> (ø)
ddtrace/tracer/civisibility_tslv.go 25.51% <ø> (ø)
ddtrace/tracer/context.go 61.90% <ø> (ø)
ddtrace/tracer/payload_v1.go 63.05% <ø> (ø)
ddtrace/tracer/rules_sampler.go 83.29% <100.00%> (ø)
ddtrace/tracer/sampler.go 93.67% <ø> (ø)
ddtrace/tracer/span_msgp.go 32.27% <ø> (ø)
ddtrace/tracer/spancontext.go 88.29% <100.00%> (ø)
ddtrace/tracer/stats.go 98.41% <ø> (ø)
ddtrace/tracer/textmap.go 84.04% <100.00%> (ø)
... and 3 more

... and 355 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter
Copy link

pr-commenter bot commented Feb 11, 2026

Benchmarks

Benchmark execution time: 2026-02-21 10:10:07

Comparing candidate commit 98c75e2 in PR branch kakkoyun/LANGPLAT-434/add_checklocks_for_span with baseline commit 69beee1 in branch main.

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:BenchmarkHttpServeTrace-25

  • 🟩 execution_time [-399.914ns; -354.286ns] or [-3.491%; -3.093%]

scenario:BenchmarkSetTagMetric-25

  • 🟩 execution_time [-13.632ns; -13.022ns] or [-18.665%; -17.830%]

scenario:BenchmarkSetTagString-25

  • 🟩 execution_time [-10.908ns; -10.292ns] or [-15.639%; -14.755%]

scenario:BenchmarkSetTagStringPtr-25

  • 🟩 execution_time [-13.170ns; -12.180ns] or [-13.969%; -12.918%]

scenario:BenchmarkSetTagStringer-25

  • 🟩 execution_time [-11.983ns; -10.819ns] or [-15.615%; -14.099%]

scenario:BenchmarkStartSpanConfig/scenario_WithStartSpanConfig-25

  • 🟩 execution_time [-144.531ns; -133.069ns] or [-5.310%; -4.889%]

scenario:BenchmarkStartSpanConfig/scenario_none-25

  • 🟩 execution_time [-153.033ns; -142.567ns] or [-5.362%; -4.995%]

@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/add_checklocks_for_span branch from 3df894a to 7631da2 Compare February 17, 2026 13:00
@kakkoyun kakkoyun added the AI Assisted AI/LLM assistance used in this PR (partially or fully) label Feb 17, 2026
@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/add_checklocks_for_span branch from 7631da2 to b2f0da6 Compare February 18, 2026 13:11
@kakkoyun kakkoyun changed the base branch from kakkoyun/LANGPLAT-434/add_checlocks_for_span_context to main February 18, 2026 13:11
@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/add_checklocks_for_span branch 2 times, most recently from 993a4b5 to 7d28293 Compare February 18, 2026 13:29
@kakkoyun kakkoyun marked this pull request as ready for review February 18, 2026 14:08
@kakkoyun kakkoyun requested review from a team as code owners February 18, 2026 14:08
@kakkoyun kakkoyun requested a review from darccio February 18, 2026 14:09
@kakkoyun kakkoyun marked this pull request as draft February 18, 2026 14:10
@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/add_checklocks_for_span branch from 7d28293 to 695c897 Compare February 18, 2026 16:31
@kakkoyun kakkoyun marked this pull request as ready for review February 18, 2026 17:41
@kakkoyun
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Nice work!

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/add_checklocks_for_span branch from 695c897 to 4ae27e0 Compare February 19, 2026 11:00
@kakkoyun
Copy link
Member Author

Benchmarks

Benchmark execution time: 2026-02-19 11:17:52

Comparing candidate commit 4ae27e0 in PR branch kakkoyun/LANGPLAT-434/add_checklocks_for_span with baseline commit a39a21d in branch main.

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

scenario:BenchmarkHttpServeTrace-25

  • 🟩 execution_time [-373.924ns; -334.876ns] or [-3.272%; -2.930%]

scenario:BenchmarkSetTagMetric-25

  • 🟩 execution_time [-14.582ns; -13.488ns] or [-19.786%; -18.302%]

scenario:BenchmarkSetTagString-25

  • 🟩 execution_time [-11.256ns; -10.590ns] or [-16.144%; -15.189%]

scenario:BenchmarkSetTagStringPtr-25

  • 🟩 execution_time [-13.948ns; -12.062ns] or [-14.807%; -12.804%]

scenario:BenchmarkSetTagStringer-25

  • 🟩 execution_time [-11.579ns; -10.555ns] or [-15.176%; -13.834%]

scenario:BenchmarkStartSpanConfig/scenario_WithStartSpanConfig-25

  • 🟩 execution_time [-145.849ns; -129.951ns] or [-5.320%; -4.740%]

scenario:BenchmarkStartSpanConfig/scenario_none-25

  • 🟩 execution_time [-154.111ns; -137.089ns] or [-5.363%; -4.770%]

This is probably the result of eliminating some closures. checklocks gets confused by them. However, nice side effect.

Add compile-time lock verification annotations to the Span struct,
the most critical data structure in the tracing library.

Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/add_checklocks_for_span branch from 4ae27e0 to 260679f Compare February 19, 2026 15:09
@darccio
Copy link
Member

darccio commented Feb 20, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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: 9c86d36006

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 93.22034% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.54%. Comparing base (4557cb1) to head (5195a97).

Files with missing lines Patch % Lines
ddtrace/tracer/span.go 90.24% 2 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/abandonedspans.go 90.64% <ø> (ø)
ddtrace/tracer/civisibility_tslv.go 25.51% <ø> (ø)
ddtrace/tracer/context.go 61.90% <ø> (ø)
ddtrace/tracer/payload_v1.go 63.05% <ø> (ø)
ddtrace/tracer/rules_sampler.go 83.29% <100.00%> (ø)
ddtrace/tracer/sampler.go 93.67% <ø> (ø)
ddtrace/tracer/span_msgp.go 32.27% <ø> (ø)
ddtrace/tracer/spancontext.go 88.29% <100.00%> (ø)
ddtrace/tracer/stats.go 98.41% <ø> (ø)
ddtrace/tracer/textmap.go 84.04% <100.00%> (ø)
... and 3 more

... and 357 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 93.22034% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.67%. Comparing base (69beee1) to head (98c75e2).

Files with missing lines Patch % Lines
ddtrace/tracer/span.go 90.24% 2 Missing and 2 partials ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/abandonedspans.go 90.64% <ø> (ø)
ddtrace/tracer/civisibility_tslv.go 25.51% <ø> (ø)
ddtrace/tracer/context.go 61.90% <ø> (ø)
ddtrace/tracer/payload_v1.go 63.05% <ø> (ø)
ddtrace/tracer/rules_sampler.go 83.29% <100.00%> (-0.28%) ⬇️
ddtrace/tracer/sampler.go 93.67% <ø> (ø)
ddtrace/tracer/span_msgp.go 32.27% <ø> (ø)
ddtrace/tracer/spancontext.go 88.29% <100.00%> (+0.05%) ⬆️
ddtrace/tracer/stats.go 98.41% <ø> (ø)
ddtrace/tracer/textmap.go 84.04% <100.00%> (ø)
... and 3 more

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-datadog-prod-us1-2
Copy link

datadog-datadog-prod-us1-2 bot commented Feb 21, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

❄️ 1 New flaky test detected

TestStopLatency from github.com/DataDog/dd-trace-go/v2/profiler (Datadog) (Fix with Cursor)
Failed

=== RUN   TestStopLatency
    profiler_test.go:251: profiler took 502.49ms to stop
--- FAIL: TestStopLatency (1.58s)

ℹ️ Info

🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 98c75e2 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

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

Labels

AI Assisted AI/LLM assistance used in this PR (partially or fully) mergequeue-status: removed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants