Skip to content

fix(ddtrace/tracer): fix BenchmarkSpanStartConcurrent#4539

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
nick.ripley/fix-benchmarkspanstartconcurrent
Mar 16, 2026
Merged

fix(ddtrace/tracer): fix BenchmarkSpanStartConcurrent#4539
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
nick.ripley/fix-benchmarkspanstartconcurrent

Conversation

@nsrip-dd

Copy link
Copy Markdown
Contributor

What does this PR do?

Refactors BenchmarkStartSpanConcurrent to use RunParallel

Motivation

This benchmark currently fails:

--- FAIL: BenchmarkStartSpanConcurrent
    benchmark.go:417: B.Loop called with timer stopped
    benchmark.go:417: B.Loop called with timer stopped
    benchmark.go:417: B.Loop called with timer stopped

The B.Loop docs don't seem to explicitly prohibit calling B.Loop from
multiple goroutines in the same test. But in practice this is what
happens since B.Loop manages the test timer internally. This benchmark
can be simplified with B.RunParallel, which is specifically made for the
kind of thing this benchmark is supposed to be measuring. And as a bonus
the benchmark works again. We lose the synchronization prior to starting
the main loop with this refactor. We could get it back if we know ahead
of time how many goroutines the test is going to create. But it doesn't
seem like a big loss.

@codecov

codecov Bot commented Mar 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.08%. Comparing base (297f9ab) to head (4e48ab6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

see 434 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-official

datadog-official Bot commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 59.32% (+3.57%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6380cfd | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@pr-commenter

pr-commenter Bot commented Mar 13, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-03-13 18:46:15

Comparing candidate commit 6380cfd in PR branch nick.ripley/fix-benchmarkspanstartconcurrent with baseline commit 2d3b985 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 157 metrics, 7 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 ----------------------------------'

This benchmark currently fails:

	--- FAIL: BenchmarkStartSpanConcurrent
	    benchmark.go:417: B.Loop called with timer stopped
	    benchmark.go:417: B.Loop called with timer stopped
	    benchmark.go:417: B.Loop called with timer stopped

The B.Loop docs don't seem to explicitly prohibit calling B.Loop from
multiple goroutines in the same test. But in practice this is what
happens since B.Loop manages the test timer internally. This benchmark
can be simplified with B.RunParallel, which is specifically made for the
kind of thing this benchmark is supposed to be measuring. And as a bonus
the benchmark works again. We lose the synchronization prior to starting
the main loop with this refactor. We could get it back if we know ahead
of time how many goroutines the test is going to create. But it doesn't
seem like a big loss.
@nsrip-dd
nsrip-dd force-pushed the nick.ripley/fix-benchmarkspanstartconcurrent branch from 4e48ab6 to 6380cfd Compare March 13, 2026 18:26
@nsrip-dd
nsrip-dd marked this pull request as ready for review March 13, 2026 20:13
@nsrip-dd
nsrip-dd requested a review from a team as a code owner March 13, 2026 20:13
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 3319a33 into main Mar 16, 2026
115 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the nick.ripley/fix-benchmarkspanstartconcurrent branch March 16, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants