Skip to content

refactor(tracer/trace): add lock assertions to trace struct#4346

Draft
kakkoyun wants to merge 7 commits intomainfrom
kakkoyun/LANGPLAT-434/assert_trace
Draft

refactor(tracer/trace): add lock assertions to trace struct#4346
kakkoyun wants to merge 7 commits intomainfrom
kakkoyun/LANGPLAT-434/assert_trace

Conversation

@kakkoyun
Copy link
Member

@kakkoyun kakkoyun commented Jan 13, 2026

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!

@kakkoyun kakkoyun changed the base branch from main to kakkoyun/LANGPLAT-434/span January 13, 2026 13:16
@kakkoyun kakkoyun marked this pull request as ready for review January 13, 2026 13:16
@kakkoyun kakkoyun requested a review from a team as a code owner January 13, 2026 13:16
@datadog-official

This comment has been minimized.

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.06%. Comparing base (86c9a30) to head (5257eb3).

Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/propagating_tags.go 68.08% <100.00%> (+0.69%) ⬆️
ddtrace/tracer/spancontext.go 88.17% <100.00%> (+0.14%) ⬆️

... and 4 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 Jan 13, 2026

Benchmarks

Benchmark execution time: 2026-01-23 12:26:17

Comparing candidate commit 5257eb3 in PR branch kakkoyun/LANGPLAT-434/assert_trace with baseline commit 86c9a30 in branch main.

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

scenario:BenchmarkExtractW3C-25

  • 🟥 execution_time [+102.366ns; +147.634ns] or [+4.398%; +6.344%]

scenario:BenchmarkInjectW3C-25

  • 🟥 execution_time [+131.136ns; +148.264ns] or [+5.806%; +6.564%]

scenario:BenchmarkOTelApiWithCustomTags/datadog_otel_api-25

  • 🟥 execution_time [+191.842ns; +221.158ns] or [+4.540%; +5.234%]

scenario:BenchmarkOTelApiWithCustomTags/otel_api-25

  • 🟥 execution_time [+216.974ns; +242.426ns] or [+3.688%; +4.121%]

scenario:BenchmarkPartialFlushing/Disabled-25

  • 🟥 execution_time [+27.137ms; +29.317ms] or [+10.256%; +11.080%]

scenario:BenchmarkPartialFlushing/Enabled-25

  • 🟥 execution_time [+29.342ms; +30.707ms] or [+10.947%; +11.457%]

scenario:BenchmarkSingleSpanRetention/no-rules-25

  • 🟥 execution_time [+31.314µs; +31.915µs] or [+13.185%; +13.438%]

scenario:BenchmarkSingleSpanRetention/with-rules/match-all-25

  • 🟥 execution_time [+30.500µs; +31.963µs] or [+12.573%; +13.175%]

scenario:BenchmarkSingleSpanRetention/with-rules/match-half-25

  • 🟥 execution_time [+31.091µs; +32.382µs] or [+12.858%; +13.391%]

scenario:BenchmarkStartSpan-25

  • 🟥 execution_time [+211.254ns; +228.746ns] or [+12.775%; +13.832%]

scenario:BenchmarkStartSpanConfig/scenario_WithStartSpanConfig-25

  • 🟥 execution_time [+198.497ns; +208.103ns] or [+6.984%; +7.322%]

scenario:BenchmarkStartSpanConfig/scenario_none-25

  • 🟥 execution_time [+200.348ns; +220.252ns] or [+6.645%; +7.305%]

scenario:BenchmarkTracerAddSpans-25

  • 🟥 execution_time [+298.894ns; +325.306ns] or [+7.317%; +7.963%]

@kakkoyun kakkoyun changed the title refactor(tracer): add lock assertions to trace struct and migrate to locking.RWMutex refactor(tracer/trace): add lock assertions to trace struct and migrate to locking.RWMutex Jan 13, 2026
@kakkoyun kakkoyun marked this pull request as draft January 13, 2026 14:35
@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/span branch 2 times, most recently from c4251df to 16a964f Compare January 15, 2026 10:40
Base automatically changed from kakkoyun/LANGPLAT-434/span to main January 15, 2026 11:52
@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/assert_trace branch 2 times, most recently from 933799c to 0af3842 Compare January 15, 2026 12:04
@kakkoyun kakkoyun marked this pull request as ready for review January 15, 2026 12:05
@kakkoyun kakkoyun marked this pull request as draft January 15, 2026 16:29
@kakkoyun kakkoyun changed the title refactor(tracer/trace): add lock assertions to trace struct and migrate to locking.RWMutex refactor(tracer/trace): add lock assertions to trace struct Jan 19, 2026
…racer

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/assert_trace branch from 0af3842 to de7ca7b Compare January 19, 2026 13:06
@kakkoyun kakkoyun changed the base branch from main to kakkoyun/LANGPLAT-434/dynamic_lock_checks January 19, 2026 13:06
@kakkoyun kakkoyun marked this pull request as ready for review January 19, 2026 13:07
@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/assert_trace branch from de7ca7b to b00e62a Compare January 19, 2026 13:40
…locking.RWMutex

Migrates trace.mu from sync.RWMutex to locking.RWMutex to enable dynamic deadlock detection.

Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
@kakkoyun kakkoyun force-pushed the kakkoyun/LANGPLAT-434/assert_trace branch from b00e62a to 80a3c36 Compare January 19, 2026 14:07
@kakkoyun kakkoyun requested a review from a team as a code owner January 19, 2026 14:07
@darccio
Copy link
Member

darccio commented Jan 19, 2026

The impact on performance looks significant. Could it be flakiness?

@kakkoyun kakkoyun marked this pull request as draft January 19, 2026 15:14
@kakkoyun
Copy link
Member Author

The impact on performance looks significant. Could it be flakiness?

Quite possible. Until I know for sure. I'll mark it as draft.

Base automatically changed from kakkoyun/LANGPLAT-434/dynamic_lock_checks to main January 20, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants