Skip to content

Commit

Permalink
test(relay): Instrument flaky test (#75361)
Browse files Browse the repository at this point in the history
`test_histogram_outliers` became flaky after
getsentry/relay#3863.

Add info to the assert to get more insights.
  • Loading branch information
jjbayer committed Aug 1, 2024
1 parent 3860f22 commit 4846445
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/relay_integration/test_metrics_extraction.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import time
import uuid

import confluent_kafka as kafka
Expand Down Expand Up @@ -148,11 +149,14 @@ def test_histogram_outliers(self):
self.post_and_retrieve_event(event_data)

histogram_outlier_tags = {}
for _ in range(1000):
buckets = []
t0 = time.monotonic()
for attempt in range(1000):
message = consumer.poll(timeout=1.0)
if message is None:
break
bucket = json.loads(message.value())
buckets.append(bucket)
try:
histogram_outlier_tags[bucket["name"]] = bucket["tags"]["histogram_outlier"]
except KeyError:
Expand All @@ -163,4 +167,8 @@ def test_histogram_outliers(self):
"d:transactions/duration@millisecond": "inlier",
"d:transactions/measurements.fcp@millisecond": "outlier",
"d:transactions/measurements.lcp@millisecond": "inlier",
}, {
"attempts": attempt,
"time_elapsed": time.monotonic() - t0,
"bucket_count": len(buckets),
}

0 comments on commit 4846445

Please sign in to comment.