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
+10 -2
View File
@@ -42,6 +42,11 @@
# `mq <нс> missing`). В фоне psql с \watch пишет /work/jobs.log (одно
# соединение): jobs|<мс>|outbox|waiting|published|processing|oldest_s|
# staging_ready. Разбор — bench/overload.py.
# cost (профиль цены телеметрии, design change track1-telemetry-cost,
# решение 10): <интервал, с> cost
# Контейнер без сети, как scan: строки `cg` всех контейнеров ВМ, `vm` и
# `mp` каждого контейнера (memory.peak, anon, oom_kill), как у queue. Ни
# psql, ни опроса LB и брокера. Разбор — bench/telemetry_cost.py.
set -u
interval=$1
@@ -50,6 +55,9 @@ mode=list
if [[ ${1:-} == scan ]]; then
mode=scan
shift
elif [[ ${1:-} == cost ]]; then
mode=cost
shift
elif [[ ${1:-} == queue ]]; then
mode=queue
queue_name=$2
@@ -290,13 +298,13 @@ hex64='^[0-9a-f]{64}$'
while :; do
# EPOCHREALTIME bash 5 — часы ВМ без запуска date
ns=${EPOCHREALTIME/./}000
if [[ $mode == scan || $mode == queue ]]; then
if [[ $mode == scan || $mode == queue || $mode == cost ]]; then
for dir in /sys/fs/cgroup/docker/*/; do
dir=${dir%/}
id=${dir##*/}
if [[ $id =~ $hex64 ]]; then
cg_line - "$id"
[[ $mode == queue ]] && mp_line "$id"
[[ $mode == queue || $mode == cost ]] && mp_line "$id"
fi
done
else