Skip to content

fix(ddtrace/tracer): TestSpansStartedTags#4000

Merged
dd-mergequeue[bot] merged 1 commit into
mainfrom
dd/deflake-test-spans-started-tags-with-eventually
Sep 29, 2025
Merged

fix(ddtrace/tracer): TestSpansStartedTags#4000
dd-mergequeue[bot] merged 1 commit into
mainfrom
dd/deflake-test-spans-started-tags-with-eventually

Conversation

@darccio

@darccio darccio commented Sep 29, 2025

Copy link
Copy Markdown
Member

PR by Bits : Fix test TestSpansStartedTags automatically detected by Flaky Test monitoring.

You can ask for changes by mentioning @DataDog in a comment.

Feedback (especially what can be better) welcome in #code-gen-feedback!


What does this PR do?

Replaces the fixed-time wait in TestSpansStartedTags with assert.Eventually to wait for the spans_started metric to reach 1. This change is applied in two places in ddtrace/tracer/metrics_test.go.

Motivation

The test was flaky because the metric increment for datadog.tracer.spans_started happens asynchronously. The previous fixed 100ms wait was sometimes insufficient in CI, leading to intermittent failures where the count was still 0 when asserted. Using assert.Eventually (1s timeout, 10ms poll) removes the timing race and stabilizes the test.

  • Impact: Flaked on 4 branches
  • Last flaked branch: rachel.yang/knuth-sample-tag
  • Category: Unit test (ddtrace/tracer/metrics_test.go)

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!

@darccio
darccio requested a review from a team as a code owner September 29, 2025 08:52
@datadog-official

Copy link
Copy Markdown
Contributor

Bits AI Dev Agent Status: ✅ Done

You can ask for changes by mentioning @DataDog in a comment.

@pr-commenter

pr-commenter Bot commented Sep 29, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-09-29 13:41:46

Comparing candidate commit faa5e26 in PR branch dd/deflake-test-spans-started-tags-with-eventually with baseline commit c0c5e01 in branch main.

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

@darccio darccio changed the title Fix flaky TestSpansStartedTags test failure fix(‎ddtrace/tracer): Fix flaky TestSpansStartedTags test failure Sep 29, 2025
@darccio
darccio force-pushed the dd/deflake-test-spans-started-tags-with-eventually branch from cd0ab9c to faa5e26 Compare September 29, 2025 13:28
@darccio darccio changed the title fix(‎ddtrace/tracer): Fix flaky TestSpansStartedTags test failure fix(‎ddtrace/tracer): TestSpansStartedTags flaky test Sep 29, 2025
@darccio darccio changed the title fix(‎ddtrace/tracer): TestSpansStartedTags flaky test fix(ddtrace/tracer): TestSpansStartedTags Sep 29, 2025
@darccio

darccio commented Sep 29, 2025

Copy link
Copy Markdown
Member Author

/merge

@dd-devflow-routing-codex

dd-devflow-routing-codex Bot commented Sep 29, 2025

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2025-09-29 13:35:56 UTC ℹ️ Start processing command /merge


2025-09-29 13:36:07 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-09-29 13:52:26 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 18m (p90).


2025-09-29 14:06:22 UTCMergeQueue: The checks failed on this merge request

Tests failed on this commit aa43c73:

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.

@genesor

genesor commented Sep 29, 2025

Copy link
Copy Markdown
Member

/merge

@dd-devflow-routing-codex

dd-devflow-routing-codex Bot commented Sep 29, 2025

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2025-09-29 14:15:29 UTC ℹ️ Start processing command /merge


2025-09-29 14:15:36 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 18m (p90).


2025-09-29 14:28:35 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue
dd-mergequeue Bot merged commit c5f0aee into main Sep 29, 2025
239 of 242 checks passed
@dd-mergequeue
dd-mergequeue Bot deleted the dd/deflake-test-spans-started-tags-with-eventually branch September 29, 2025 14:28
darccio added a commit that referenced this pull request Oct 7, 2025
Co-authored-by: datadog-official[bot] <214633350+datadog-official[bot]@users.noreply.github.com>
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