6
6
import os
7
7
import asyncio
8
8
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 } " )
9
15
10
16
# enable verbose logging in case something goes wrong
11
17
# 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():
28
34
os .environ ["AWS_LAMBDA_FUNCTION_NAME" ] = ""
29
35
Config .agent_endpoint = "tcp://0.0.0.0:25888"
30
36
31
- metric_name = "TCP-MultiFlush"
37
+ metric_name = f "TCP-MultiFlush- { test_id } "
32
38
expected_sample_count = 3
33
39
34
40
@metric_scope
@@ -59,7 +65,7 @@ async def test_end_to_end_udp():
59
65
os .environ ["AWS_LAMBDA_FUNCTION_NAME" ] = ""
60
66
Config .agent_endpoint = "udp://0.0.0.0:25888"
61
67
62
- metric_name = "UDP-SingleFlush"
68
+ metric_name = f "UDP-SingleFlush- { test_id } "
63
69
64
70
@metric_scope
65
71
async def do_work (metrics ):
@@ -103,10 +109,10 @@ def metric_exists(metric_name, expected_samples=1):
103
109
return True
104
110
elif total_samples > expected_samples :
105
111
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 } "
107
113
)
108
114
else :
109
115
print (response ["Datapoints" ])
110
- print (f"Expected #{ expected_samples } , received # { total_samples } ." )
116
+ print (f"Expected #{ expected_samples } , received { total_samples } ." )
111
117
112
118
return False
0 commit comments