Update telemetry dependencies and align acceptance clocks and measurement windows
This commit is contained in:
@@ -26,7 +26,7 @@ def observation(name):
|
||||
return scalar('sum(messenger_telemetry_export{service_name="messenger-api",observation="'+name+'"})')
|
||||
|
||||
|
||||
def telemetry_snapshot():
|
||||
def telemetry_snapshot(instance_ids):
|
||||
# Read Collector endpoints directly after quiescence: no extra Prometheus
|
||||
# scrape delay may move warmup payload into the measurement baseline.
|
||||
with urllib.request.urlopen('http://127.0.0.1:19464/metrics', timeout=5) as response:
|
||||
@@ -35,7 +35,7 @@ def telemetry_snapshot():
|
||||
'spans_pending', 'spans_in_flight', 'spans_queue_lost',
|
||||
'traces_wire_bytes', 'logs_wire_bytes', 'metrics_wire_bytes')}
|
||||
for line in text.splitlines():
|
||||
if line.startswith('messenger_telemetry_export{') and 'service_name="messenger-api"' in line:
|
||||
if line.startswith('messenger_telemetry_export{') and any('service_instance_id="'+value+'"' in line for value in instance_ids):
|
||||
match = re.search(r'observation="([^"]+)"', line)
|
||||
if match and match[1] in counts:
|
||||
counts[match[1]] += float(line.rsplit(' ', 1)[1])
|
||||
@@ -86,11 +86,15 @@ def run_profile(client, profile, repeat):
|
||||
subprocess.run(command, env=env, cwd=ROOT, check=True, capture_output=True)
|
||||
wait_for(lambda: client.request('GET','/api/v1/users/me')[0] == 200, 30)
|
||||
# Establish each process/meter and warm the same endpoint before taking baselines.
|
||||
instance_ids = set()
|
||||
for _ in range(40):
|
||||
assert client.request('GET','/api/v1/users/me')[0] == 200
|
||||
status, _, headers = client.request('GET','/api/v1/users/me')
|
||||
assert status == 200
|
||||
instance_ids.add({key.lower():value for key,value in headers.items()}['x-instance-id'])
|
||||
time.sleep(.1)
|
||||
assert len(instance_ids) == 2
|
||||
time.sleep(10)
|
||||
before = telemetry_snapshot()
|
||||
before = telemetry_snapshot(instance_ids)
|
||||
memory_before = cgroups(['api','worker','collector'])
|
||||
compose('exec','-T','postgres','psql','-U','messenger','-d','messenger','-c',
|
||||
"INSERT INTO test_faults(point,action) VALUES ('after_upload_commit','error'),('after_upload_commit','error')")
|
||||
@@ -134,11 +138,11 @@ def run_profile(client, profile, repeat):
|
||||
calls.append(future.result())
|
||||
if lock_future:
|
||||
lock_future.result()
|
||||
elapsed = time.monotonic()-started
|
||||
elapsed = time.monotonic()-started
|
||||
assert sum(x['status']==500 for x in calls)==2, 'Expected exactly two controlled upload errors'
|
||||
assert all(x['status'] in (200,500) for x in calls), 'Unexpected business failure'
|
||||
time.sleep(10)
|
||||
after = telemetry_snapshot()
|
||||
after = telemetry_snapshot(instance_ids)
|
||||
memory_after = cgroups(['api','worker','collector'])
|
||||
rare = [row for row in calls if row['status']==500 or (row['kind']=='read' and row['duration_s']>=.15)]
|
||||
for row in rare:
|
||||
@@ -147,7 +151,7 @@ def run_profile(client, profile, repeat):
|
||||
assert row['found_in_tempo'], 'Sampled rare trace failed ingestion'
|
||||
latency = [row['duration_s'] for row in calls]
|
||||
deltas = {key: after[key]-before[key] for key in before}
|
||||
return {'profile':name,'enabled':enabled,'sampling_ratio':float(ratio),'repeat':repeat,
|
||||
return {'profile':name,'instance_ids':sorted(instance_ids),'enabled':enabled,'sampling_ratio':float(ratio),'repeat':repeat,
|
||||
'offered_rps':OFFERED,'duration_s':DURATION,'elapsed_s':round(elapsed,6),
|
||||
'scheduled':DURATION*OFFERED,'not_sent':dropped,'sent':len(calls),
|
||||
'successful':sum(row['status']==200 for row in calls),'controlled_500':2,
|
||||
|
||||
Reference in New Issue
Block a user