Skip to content

fix(telemetry): data race between test and auto flush#3920

Merged
dd-mergequeue[bot] merged 1 commit into
mainfrom
eliottness/telemetry-test-datarace
Aug 27, 2025
Merged

fix(telemetry): data race between test and auto flush#3920
dd-mergequeue[bot] merged 1 commit into
mainfrom
eliottness/telemetry-test-datarace

Conversation

@eliottness

@eliottness eliottness commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds a mutex before flushing data from the telemetry client so only one at a time can happen

Motivation

This PR fixes the data races found here that could theoretically happen if somehow the main goroutine of a test ran slower than one full minute which would trigger auto flush before the actual writer was changed for the record writer and multiple small other things like this that are very unlikely to happen in real life

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!

@eliottness
eliottness marked this pull request as ready for review August 27, 2025 11:23
@eliottness
eliottness requested a review from a team as a code owner August 27, 2025 11:23
@pr-commenter

pr-commenter Bot commented Aug 27, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-08-27 11:31:55

Comparing candidate commit 5f167d7 in PR branch eliottness/telemetry-test-datarace with baseline commit 9b7027e in branch main.

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

@eliottness

Copy link
Copy Markdown
Contributor Author

/merge

@dd-devflow-routing-codex

dd-devflow-routing-codex Bot commented Aug 27, 2025

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2025-08-27 11:52:20 UTC ℹ️ Start processing command /merge


2025-08-27 11:52:25 UTC ℹ️ MergeQueue: pull request added to the queue

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


2025-08-27 12:03:51 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue
dd-mergequeue Bot merged commit 98c4c03 into main Aug 27, 2025
225 checks passed
@dd-mergequeue
dd-mergequeue Bot deleted the eliottness/telemetry-test-datarace branch August 27, 2025 12:03
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.

2 participants