lab6
This commit is contained in:
@@ -3,3 +3,16 @@
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
|
||||
Результаты реализации lab6:
|
||||
|
||||
- `verification.md` — итоговые проверки и время инцидентов (Москва).
|
||||
- `observability.json` — реальный trace, parent-child связь, проверенные метрики/PromQL.
|
||||
- `incidents.json` — firing/resolved, retry trace и ограниченный отказ telemetry backend.
|
||||
- `load.json` — 30-секундный closed-loop прогон синтетических POST сообщений.
|
||||
|
||||
Запросы Grafana находятся в `infra/grafana/dashboards/messenger.json`, методика — в `REPORT.md`.
|
||||
|
||||
Track 1: `track1-benchmark.md` содержит сравнение A/B/C, `track1-benchmark.json` —
|
||||
все отдельные прогоны, latency samples, Docker stats, counters Collector и параметры хоста.
|
||||
Методика: `python3 scripts/benchmark_telemetry.py --requests 1000 --concurrency 4 --repetitions 3`.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
[
|
||||
{
|
||||
"event": "worker_stopped_upload_accepted",
|
||||
"timestamp": "2026-11-16T07:30:35.969738+00:00"
|
||||
},
|
||||
{
|
||||
"event": "QueueLagGrowing_firing",
|
||||
"timestamp": "2026-11-16T07:31:50.091878+00:00",
|
||||
"depth": 1.0,
|
||||
"oldest_seconds": 61.100729
|
||||
},
|
||||
{
|
||||
"event": "QueueLagGrowing_resolved_backlog_drained",
|
||||
"timestamp": "2026-11-16T07:32:10.680368+00:00"
|
||||
},
|
||||
{
|
||||
"event": "database_stopped",
|
||||
"timestamp": "2026-11-16T07:32:10.928124+00:00"
|
||||
},
|
||||
{
|
||||
"event": "ApiHighErrorRate_firing",
|
||||
"timestamp": "2026-11-16T07:32:54.959429+00:00",
|
||||
"response_counts": {
|
||||
"503": 1,
|
||||
"502": 87
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "ApiHighErrorRate_resolved_database_recovered",
|
||||
"timestamp": "2026-11-16T07:33:55.054932+00:00"
|
||||
},
|
||||
{
|
||||
"event": "s3_failure_scheduled_retry",
|
||||
"timestamp": "2026-11-16T07:33:57.449574+00:00",
|
||||
"trace_id": "997e005d6cc34eaa869fc3ced3e479ee"
|
||||
},
|
||||
{
|
||||
"event": "retry_same_trace_ready_verified",
|
||||
"timestamp": "2026-11-16T07:33:58.678216+00:00",
|
||||
"trace_id": "997e005d6cc34eaa869fc3ced3e479ee"
|
||||
},
|
||||
{
|
||||
"event": "tempo_loki_stopped",
|
||||
"timestamp": "2026-11-16T07:34:08.938180+00:00"
|
||||
},
|
||||
{
|
||||
"event": "telemetry_outage_api_worker_healthy",
|
||||
"timestamp": "2026-11-16T07:34:30.248711+00:00",
|
||||
"failed_span_exports": 46.0,
|
||||
"collector_rss_bytes": 179634176.0
|
||||
},
|
||||
{
|
||||
"event": "tempo_loki_restarted",
|
||||
"timestamp": "2026-11-16T07:34:30.765794+00:00"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"lab": 6,
|
||||
"workload": "closed-loop POST messages; no automatic retries",
|
||||
"requested_duration_seconds": 30.0,
|
||||
"elapsed_seconds": 30.026,
|
||||
"concurrency": 4,
|
||||
"successful_requests": 10338,
|
||||
"failed_requests": 0,
|
||||
"error_ratio": 0.0,
|
||||
"successful_rps": 344.305,
|
||||
"successful_latency_ms": {
|
||||
"p50": 5.666,
|
||||
"p95": 52.505,
|
||||
"p99": 61.702
|
||||
},
|
||||
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"timestamp": "2026-11-16T15:21:12.712973+00:00",
|
||||
"result": "PASS",
|
||||
"trace_id": "c3280a5a6f0d494f8f62834603b982a0",
|
||||
"span_names": [
|
||||
"POST /api/v1/chats/{chat_id}/attachments",
|
||||
"attachment.enqueue",
|
||||
"attachment.process",
|
||||
"jobs:attachments publish",
|
||||
"postgresql.pool.acquire",
|
||||
"postgresql.publish_ready",
|
||||
"s3.delete_object",
|
||||
"s3.get_object",
|
||||
"s3.put_object",
|
||||
"s3.stat_object"
|
||||
],
|
||||
"consumer_parent_is_producer": true,
|
||||
"log_services": [
|
||||
"messenger-api",
|
||||
"messenger-worker"
|
||||
],
|
||||
"metric_names_checked": [
|
||||
"http_server_requests_total",
|
||||
"http_server_request_duration_seconds_bucket",
|
||||
"worker_jobs_total",
|
||||
"worker_job_duration_seconds_bucket",
|
||||
"attachment_ready_duration_seconds_bucket",
|
||||
"queue_depth",
|
||||
"queue_oldest_age",
|
||||
"db_pool_used",
|
||||
"db_pool_waiting",
|
||||
"worker_busy",
|
||||
"worker_capacity",
|
||||
"process_memory_usage",
|
||||
"process_cpu_time"
|
||||
],
|
||||
"dashboard_queries_checked": 25,
|
||||
"privacy_canaries": "absent in recent logs and upload trace"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
# Track 1: Цена наблюдаемости
|
||||
|
||||
Результат: **PASS**. Начало UTC: 2026-11-16T14:52:30.645168+00:00.
|
||||
|
||||
По 3 прогона каждого варианта, 1000 POST uploads, concurrency 4, warm-up 20 uploads.
|
||||
Порядок ABC / BCA / CAB. PNG: 111817 bytes. Каждый job дошёл до ready; очередь между прогонами пуста.
|
||||
Таблица содержит медианы результатов прогонов, включая медиану индивидуальных p50/p99 (не pooled percentile).
|
||||
RPS и latency — HTTP 202 acceptance. CPU/RAM — средние docker stats за upload + полный drain worker; API = сумма двух реплик.
|
||||
CPU: 100% = одно логическое ядро. RAM: MiB; это Docker working set, не peak RSS. Spans/s = delta accepted_spans / окно ingest, включающее финальный flush.
|
||||
|
||||
| Настройка | RPS | p50 latency, ms | p99 latency, ms | CPU API | RAM API, MiB | CPU Worker | RAM Worker, MiB | Spans/sec (ingest) |
|
||||
|---|---:|---:|---:|---:|---:|---:|---:|---:|
|
||||
| A: Off | 84.37 | 27.30 | 202.70 | 10.32% | 14.22 | 34.79% | 6.88 | 0.00 |
|
||||
| B: On, SDK 100% / Collector 100% | 75.44 | 30.46 | 288.30 | 12.64% | 17.05 | 38.48% | 7.81 | 391.01 |
|
||||
| C: On, SDK 100% / Collector 10% | 75.28 | 30.48 | 204.05 | 13.31% | 16.58 | 39.12% | 7.88 | 412.19 |
|
||||
|
||||
| Настройка | Mean HTTP, ms | Pipeline, s | Accepted spans | Tempo sent spans | Tempo spans/s | CPU API, ms/job* | CPU Worker, ms/job* |
|
||||
|---|---:|---:|---:|---:|---:|---:|---:|
|
||||
| A | 46.89 | 79.95 | 0 | 0 | 0.00 | 7.80 | 27.81 |
|
||||
| B | 52.56 | 69.12 | 28231 | 28230 | 391.00 | 8.57 | 26.60 |
|
||||
| C | 52.82 | 65.37 | 28218 | 3083 | 44.78 | 8.75 | 25.82 |
|
||||
|
||||
*CPU ms/job — оценка по среднему docker stats CPU% и длительности pipeline, не аппаратный профиль CPU.
|
||||
Accepted spans — вход в Collector; sampling в C выполняется после receiver и не уменьшает стоимость SDK/OTLP ingest. Это количества spans, не bytes.
|
||||
В C логи и метрики остаются на 100%; отношение sent/accepted измеряет намеренное сокращение trace export.
|
||||
|
||||
| Прогон | RPS | mean HTTP, ms | p99, ms | Pipeline, s | Stats samples API / Worker | Refused / failed export spans |
|
||||
|---|---:|---:|---:|---:|---:|---:|
|
||||
| A/1 | 79.03 | 50.13 | 201.98 | 79.95 | 320 / 160 | 0 / 0 |
|
||||
| B/1 | 78.94 | 50.20 | 200.24 | 69.12 | 276 / 138 | 0 / 0 |
|
||||
| C/1 | 75.28 | 52.82 | 204.05 | 65.37 | 260 / 130 | 0 / 0 |
|
||||
| B/2 | 75.44 | 52.56 | 288.30 | 65.36 | 260 / 130 | 0 / 0 |
|
||||
| C/2 | 77.95 | 50.86 | 202.22 | 64.91 | 258 / 129 | 0 / 0 |
|
||||
| A/2 | 85.62 | 46.41 | 202.70 | 63.87 | 254 / 127 | 0 / 0 |
|
||||
| C/3 | 68.84 | 57.60 | 212.64 | 73.28 | 292 / 146 | 0 / 0 |
|
||||
| A/3 | 84.37 | 46.89 | 413.17 | 140.02 | 560 / 280 | 0 / 0 |
|
||||
| B/3 | 69.37 | 57.14 | 437.94 | 137.77 | 550 / 275 | 0 / 0 |
|
||||
|
||||
SDK audit: delta warning/error diagnostics в on-окнах: [0.0]; значения перед началом окон: [0.0, 4.0]. Startup/reconfiguration не входит в steady-state замер.
|
||||
Максимум telemetry_sdk_dropped_spans в интервале эксперимента: 0.0. Это счётчик переполнения span batch queue, не точный аудит всех возможных потерь SDK.
|
||||
|
||||
Отдельный synthetic ERROR probe (вне замеров API): {"type": "synthetic ERROR spans, separate from upload benchmark", "sent": 100, "found_in_tempo": 9, "missing_in_tempo": 91}.
|
||||
|
||||
## Воспроизведение
|
||||
|
||||
```sh
|
||||
python3 scripts/benchmark_telemetry.py --requests 1000 --concurrency 4 --repetitions 3
|
||||
```
|
||||
|
||||
Если Docker Snap не находит Compose plugin, передать --compose /path/to/docker-compose --docker /path/to/docker.
|
||||
Скрипт проверяет 2 API + 1 worker, завершение всех jobs, отсутствие HTTP/Collector ошибок и фактический процент экспорта.
|
||||
В finally восстанавливаются SDK on и исходный Collector 100%. Данные/volumes не удаляются.
|
||||
|
||||
## Ограничения
|
||||
|
||||
Closed-loop, один хост, 3 повтора, фоновые health/outbox spans включены. Размер БД/S3 растёт; порядок вариантов ротируется, новых чатов и файлов поровну.
|
||||
Warm-up не устраняет весь cache/thermal/I/O шум. Относительные CPU/RAM различия — наблюдения этой конфигурации, не универсальная надбавка 20–40%.
|
||||
Docker CPU/RAM и клиентская latency не изолируют стоимость SDK от общего давления Collector/backends на тот же хост.
|
||||
Приватные payloads, пароли и токены в evidence не записываются. Полные sanitized samples/latencies и hardware/limits: track1-benchmark.json.
|
||||
@@ -0,0 +1,34 @@
|
||||
# Фактическая проверка — 16.11.2026
|
||||
|
||||
- Clean Dockerfile build: PASS, runtime loader dependency included.
|
||||
- Compose config and Collector validate: PASS.
|
||||
- Prometheus config + 3 alert rules (promtool): PASS.
|
||||
- C++ W3C context/invalid-context/route-privacy self-test: PASS.
|
||||
- Public lab6 API smoke with telemetry on and off: PASS.
|
||||
- Disabled SDK durable payload: traceparent absent, not an empty invalid field.
|
||||
- Real upload trace parent-child chain API/outbox/Redis/worker/S3/DB: PASS.
|
||||
- Loki events from both services correlated by trace ID: PASS.
|
||||
- Provisioned dashboard: 25 PromQL queries checked.
|
||||
- Privacy canaries absent in recent Loki events and selected upload trace.
|
||||
- Whole delivered incidents.py run against final image: PASS.
|
||||
- All affected services restored; SDK enabled.
|
||||
|
||||
Load: 10338 successes / 0 errors, 344.305 RPS; client p50/p95/p99 5.666/52.505/61.702 ms.
|
||||
Closed-loop synthetic message load, concurrency 4, 30 seconds; not a capacity or 30-minute SLO proof.
|
||||
|
||||
| Событие | Москва, UTC+3 |
|
||||
|---|---|
|
||||
| worker_stopped_upload_accepted | 10:30:35 |
|
||||
| QueueLagGrowing_firing | 10:31:50 |
|
||||
| QueueLagGrowing_resolved_backlog_drained | 10:32:10 |
|
||||
| database_stopped | 10:32:10 |
|
||||
| ApiHighErrorRate_firing | 10:32:54 |
|
||||
| ApiHighErrorRate_resolved_database_recovered | 10:33:55 |
|
||||
| s3_failure_scheduled_retry | 10:33:57 |
|
||||
| retry_same_trace_ready_verified | 10:33:58 |
|
||||
| tempo_loki_stopped | 10:34:08 |
|
||||
| telemetry_outage_api_worker_healthy | 10:34:30 |
|
||||
| tempo_loki_restarted | 10:34:30 |
|
||||
|
||||
Evidence contains only synthetic technical IDs, timestamps and aggregate metrics. Full backend payloads, credentials and message bodies were not saved.
|
||||
Limits: no prolonged memory soak or exhaustive privacy audit; SDK log-queue drops are not counted exactly (see REPORT.md).
|
||||
Reference in New Issue
Block a user