Skip to content

Commit 13e24ce

Browse files
chore(ci): fix priority_sampling test case (#3555) (#3563)
The logic was updated in DataDog/datadog-agent#10958 (agent v7.35.0) to only return the rates after both 5 seconds have passed and another request has been sent. (cherry picked from commit 0453062) Co-authored-by: Kyle Verhoog <[email protected]>
1 parent 62e3b41 commit 13e24ce

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tests/integration/test_integration.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,19 +336,21 @@ def test_priority_sampling_response(encoding, monkeypatch):
336336
s.set_tag("env", "my-env")
337337
s.finish()
338338
assert "service:my-svc,env:my-env" not in t._writer._priority_sampler._by_service_samplers
339-
t.shutdown()
339+
t.flush()
340340

341-
# For some reason the agent doesn't start returning the service information
342-
# immediately
343-
import time
341+
# If a previous test has run then the agent might reply immediately
342+
if "service:my-svc,env:my-env" not in t._writer._priority_sampler._by_service_samplers:
343+
# The Agent only returns updated sampling rates once 5 seconds have passed and another request has been sent.
344+
import time
344345

345-
time.sleep(5)
346+
time.sleep(5)
347+
with t.trace("operation", service="my-svc") as s:
348+
s.set_tag("env", "my-env")
349+
t.flush()
346350

347-
t = Tracer()
348-
s = t.trace("operation", service="my-svc")
349-
s.set_tag("env", "my-env")
350-
s.finish()
351-
assert "service:my-svc,env:my-env" not in t._writer._priority_sampler._by_service_samplers
351+
# Agent will now reply with the sampling rates
352+
with t.trace("operation", service="my-svc") as s:
353+
s.set_tag("env", "my-env")
352354
t.shutdown()
353355
assert "service:my-svc,env:my-env" in t._writer._priority_sampler._by_service_samplers
354356

0 commit comments

Comments
 (0)