fix(ddtrace/tracer): avoid race on TestTracerPrioritySampler#4490
fix(ddtrace/tracer): avoid race on TestTracerPrioritySampler#4490
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-03-10 10:34:05 Comparing candidate commit f65d0f8 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 155 metrics, 8 unstable metrics.
|
ddtrace/tracer/tracer_test.go
Outdated
| // response asynchronously, so we must poll rather than use a fixed sleep. | ||
| timeout := time.After(time.Second * timeMultiplicator) | ||
| for { | ||
| tr.prioritySampling.mu.RLock() |
There was a problem hiding this comment.
nit: Maybe we should consider adding a prioritySampling.getDefaultRate() function where we guard with mutex.
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: f65d0f8 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
What does this PR do?
Adds a loop to check if priority sampler is updated on
TestTracerPrioritySampleras we emulate therate_by_serviceof the agent on response.Motivation
Avoid flakiness like https://github.com/DataDog/dd-trace-go/actions/runs/22556129490/job/65333714361#step:8:302
Reviewer's Checklist
make lintlocally.make testlocally.Unsure? Have a question? Request a review!