Собрать наблюдаемый стенд, чтобы причину деградации API и worker было видно по метрикам, логам и трассам.

This commit is contained in:
2026-11-07 01:36:19 +03:00
parent 470d9d6f1e
commit 7d4e1237a3
56 changed files with 4419 additions and 53 deletions
+78
View File
@@ -0,0 +1,78 @@
{
"alerts_before": {
"AttachmentReadyLatencyHigh": "pending"
},
"while_worker_stopped": {
"first_firing": {
"WorkerConsumersZero": 75.5,
"QueueLagHigh": 105.7
},
"samples": [
{
"t": 90.6,
"alerts": {
"QueueLagHigh": "pending",
"AttachmentReadyLatencyHigh": "firing",
"WorkerConsumersZero": "firing"
},
"age": "82.87327",
"api_consumers": "0"
},
{
"t": 95.6,
"alerts": {
"QueueLagHigh": "pending",
"AttachmentReadyLatencyHigh": "firing",
"WorkerConsumersZero": "firing"
},
"age": "88.417685",
"api_consumers": "0"
},
{
"t": 100.7,
"alerts": {
"QueueLagHigh": "pending",
"AttachmentReadyLatencyHigh": "firing",
"WorkerConsumersZero": "firing"
},
"age": "92.908538",
"api_consumers": "0"
},
{
"t": 105.7,
"alerts": {
"QueueLagHigh": "firing",
"AttachmentReadyLatencyHigh": "firing",
"WorkerConsumersZero": "firing"
},
"age": "98.453736",
"api_consumers": "0"
}
]
},
"after_worker_start": {
"cleared_after_seconds": {
"QueueLagHigh": 20.1,
"WorkerConsumersZero": 20.1
},
"alerts": {
"AttachmentReadyLatencyHigh": "firing"
}
},
"tempo_down_40s": {
"api_results": {
"200": 76
},
"failed_before": [
"9"
],
"failed_after": [
"24"
],
"queue_size": [
"0",
"22"
],
"collector_memory": "68.8MiB / 320MiB"
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"lab": 6,
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 15.0,
"elapsed_seconds": 15.078,
"concurrency": 2,
"successful_requests": 1247,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 82.703,
"successful_latency_ms": {
"p50": 31.0,
"p95": 47.0,
"p99": 47.0
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
+16
View File
@@ -0,0 +1,16 @@
{
"trace_id": "cf5025ad9d9a2a248da8335a0c6caee2",
"log": {
"job.retry": {"attempt": 1, "same_trace": true},
"job.ready": {"attempt": 2, "same_trace": true}
},
"chain": [
"POST /api/v1/chats/{chat_id}/attachments",
"attachment.process publish parent=POST",
"attachment.process consume (attempt 1, injected transient) parent=publish",
"attachment.process consume (attempt 2) parent=publish",
"s3.get and s3.put parent=second consume",
"db.transaction parent=POST and parent=consume"
],
"note": "Both consumer spans share the producer span as parent. No message text, filename, or object key is stored here."
}
+89
View File
@@ -0,0 +1,89 @@
{
"started": "2026-11-06T21:40:04Z",
"retry_upload": {
"final_status": "ready",
"log": {
"event": "job.ready",
"attempt": 1,
"trace_id": "40c8e289c22994a3c786030354799554",
"span_id": "606017e0d8c6f6b5",
"service": "messenger-worker"
},
"consume_spans": 1,
"span_names": [
"POST /api/v1/chats/{chat_id}/attachments",
"db.transaction",
"db.transaction",
"s3.put",
"db.transaction",
"db.transaction",
"attachment.process publish",
"attachment.process consume",
"db.transaction",
"s3.get",
"s3.put",
"s3.put",
"db.transaction"
],
"parents_linked": true
},
"warmup": {
"200": 180
},
"alerts_after_warmup": {},
"short_spike": {
"500": 20
},
"alerts_after_short_spike": {
"ApiHighErrorRate": "pending",
"ApiErrorBudgetSlowBurn": "pending"
},
"recovery_after_spike": {
"200": 40
},
"fast_burn_detected_after_seconds": 51.6,
"alerts_when_fast_burn_fired": {
"ApiHighErrorRate": "firing",
"ApiErrorBudgetSlowBurn": "firing",
"ApiErrorBudgetFastBurn": "firing"
},
"sustained_counts_until_detection_or_timeout": {
"500": 104
},
"fast_burn_resolved_after_seconds": 70.6,
"alerts_after_resolve": {
"ApiHighErrorRate": "firing",
"ApiErrorBudgetSlowBurn": "firing"
},
"worker_stopped": {
"consumers_firing_after_seconds": null,
"queue_lag_firing_after_seconds": 0.0,
"alerts": {
"ApiHighErrorRate": "firing",
"ApiErrorBudgetSlowBurn": "firing",
"QueueLagHigh": "firing"
}
},
"worker_restored": {
"consumers_cleared_after_seconds": 0.0,
"alerts": {
"ApiHighErrorRate": "firing",
"ApiErrorBudgetSlowBurn": "firing",
"QueueLagHigh": "firing"
}
},
"latency_note": "db_slow_ms sleeps inside db.transaction; handler_slow_ms sleeps in the HTTP span and outside that span",
"tempo_stopped": {
"api_results": {
"200": 16
},
"failed_spans_before": [
"0"
],
"failed_spans_after": [
"0"
],
"collector_memory": "67.75MiB / 320MiB"
},
"finished": "2026-11-06T21:48:01Z"
}