Skip to content

Commit f5688e6

Browse files
committed
add random value to metric name
1 parent 7b68449 commit f5688e6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/integ/agent/test_end_to_end.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
import os
77
import asyncio
88
from datetime import datetime, timedelta
9+
from random import randint
10+
11+
# use a random number in metric names to avoid collisions
12+
test_id = randint(0, 100)
13+
14+
print(f"Using test-id {test_id}")
915

1016
# enable verbose logging in case something goes wrong
1117
# pytest won't actually output any of the logs unless it fails
@@ -28,7 +34,7 @@ async def test_end_to_end_tcp_multiple_flushes():
2834
os.environ["AWS_LAMBDA_FUNCTION_NAME"] = ""
2935
Config.agent_endpoint = "tcp://0.0.0.0:25888"
3036

31-
metric_name = "TCP-MultiFlush"
37+
metric_name = f"TCP-MultiFlush-{test_id}"
3238
expected_sample_count = 3
3339

3440
@metric_scope
@@ -59,7 +65,7 @@ async def test_end_to_end_udp():
5965
os.environ["AWS_LAMBDA_FUNCTION_NAME"] = ""
6066
Config.agent_endpoint = "udp://0.0.0.0:25888"
6167

62-
metric_name = "UDP-SingleFlush"
68+
metric_name = f"UDP-SingleFlush-{test_id}"
6369

6470
@metric_scope
6571
async def do_work(metrics):
@@ -103,10 +109,10 @@ def metric_exists(metric_name, expected_samples=1):
103109
return True
104110
elif total_samples > expected_samples:
105111
raise Exception(
106-
f"Too many datapoints returned. Expected #{expected_samples}, received #{total_samples}"
112+
f"Too many datapoints returned. Expected {expected_samples}, received {total_samples}"
107113
)
108114
else:
109115
print(response["Datapoints"])
110-
print(f"Expected #{expected_samples}, received #{total_samples}.")
116+
print(f"Expected #{expected_samples}, received {total_samples}.")
111117

112118
return False

0 commit comments

Comments
 (0)