From b602796e81667acba0323eb22874b0c612766994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BB=D1=8C=D0=B5=D0=B2=20=D0=9D?= =?UTF-8?q?=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Mon, 16 Nov 2026 03:17:45 +0300 Subject: [PATCH] Exercise uncached session lookup for reproducible rare slow traces --- research/observability_cost.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/research/observability_cost.py b/research/observability_cost.py index 757f1754..36f87902 100644 --- a/research/observability_cost.py +++ b/research/observability_cost.py @@ -127,7 +127,7 @@ def run_profile(client, profile, repeat): time.sleep(delay) if index == 160: lock_future = executor.submit(compose,'exec','-T','postgres','psql','-U','messenger','-d','messenger','-c', - 'BEGIN; LOCK TABLE users IN ACCESS EXCLUSIVE MODE; SELECT pg_sleep(0.35); COMMIT;') + 'BEGIN; LOCK TABLE sessions IN ACCESS EXCLUSIVE MODE; SELECT pg_sleep(0.35); COMMIT;') ready = [future for future in pending if future.done()] for future in ready: calls.append(future.result()) @@ -146,6 +146,7 @@ def run_profile(client, profile, repeat): time.sleep(10) after = telemetry_snapshot(instance_ids) memory_after = cgroups(['api','worker','collector','tempo']) + assert any(row['kind']=='read' and row['duration_s']>=.15 for row in calls), 'Slow read probe did not occur' rare = [row for row in calls if row['status']==500 or (row['kind']=='read' and row['duration_s']>=.15)] for row in rare: row['found_in_tempo'] = exists(row['trace_id']) @@ -169,7 +170,7 @@ def main(): report = {'started_at':datetime.now(UTC).isoformat(),'track':'observability cost','runs':[], 'method':{'profiles':PROFILES,'repeats':3,'offered_rps':OFFERED,'measurement_s':DURATION, 'latency_clock':'client perf_counter, includes network and queueing', - 'rare_slow':'one 350ms exclusive users-table lock/run', + 'rare_slow':'one 350ms exclusive sessions-table lock/run', 'rare_errors':'two actual API500 after durable upload COMMIT/run through private local fault hooks', 'wire_bytes':'protobuf body length on each SDK HTTP send, retries included; excludes HTTP/TLS headers', 'sdk_queue_losses':'conservation after 10s quiescence, separate from sampled-out spans',