feat: telemetry cost profile with head sampling, coarse buckets and balanced tail sampling

- [telemetry] trace_sample_ratio (ParentBased(TraceIdRatioBased), 1 keeps
  ParentBased(ALWAYS_ON)) and metric_buckets (default|coarse with SLO bounds),
  export interval <= 30 s; otel.sdk.span.started, span.live dropped; startup
  records name ratio, buckets and interval
- bench: telemetry services on mtusi-bench, TELEMETRY=on switch for uploads
  and queue, make bench_telemetry[_quick] with off/full/full-aa/head/tail/
  metrics/balanced, rare events, lookup from Tempo/Loki/Prometheus, cost
  sampler, verdicts H1-H8 and B1-B5; collector layers and lean Prometheus in
  bench/otel with preflight checks
- REPORT: telemetry cost hypotheses and criteria before the label

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 19:17:25 +03:00
co-authored by Claude Opus 5.5
parent 37f86801d6
commit 509afca89e
43 changed files with 5784 additions and 159 deletions
+9
View File
@@ -15,6 +15,7 @@ from fakes import (
FakeUnitOfWork,
)
from src.config import settings
from src.schemas.enums import MetricBucketsEnum
@pytest.fixture
@@ -44,6 +45,14 @@ def fixed_settings(monkeypatch: pytest.MonkeyPatch) -> None:
{"body_timeout_seconds": 1, "max_unfinished_jobs": 0},
),
(settings.app, {"instance_id": "test-instance"}),
(
settings.telemetry,
{
"trace_sample_ratio": 1.0,
"metric_buckets": MetricBucketsEnum.DEFAULT,
"metric_export_interval_seconds": 15,
},
),
)
for section, fields in fixed:
for name, value in fields.items():