feat: Add live dashboard and freeze SLO alerts (U3/U4 setup)
This commit is contained in:
@@ -1,19 +1,26 @@
|
||||
{
|
||||
"uid": "lab6-telemetry",
|
||||
"title": "Lab 6 · Telemetry stack",
|
||||
"tags": ["lab6"],
|
||||
"title": "Lab 6 · Messenger signals",
|
||||
"tags": [
|
||||
"lab6"
|
||||
],
|
||||
"timezone": "browser",
|
||||
"schemaVersion": 40,
|
||||
"version": 1,
|
||||
"version": 2,
|
||||
"refresh": "10s",
|
||||
"time": { "from": "now-1h", "to": "now" },
|
||||
"time": {
|
||||
"from": "now-1h",
|
||||
"to": "now"
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "timeseries",
|
||||
"title": "Telemetry stores and collector reachable",
|
||||
"description": "Prometheus self-scrape and internal /metrics endpoints. API and worker panels follow their actual exported metric names.",
|
||||
"datasource": { "type": "prometheus", "uid": "prometheus" },
|
||||
"title": "Stores",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
@@ -21,26 +28,565 @@
|
||||
"legendFormat": "{{job}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": { "defaults": { "min": 0, "max": 1 }, "overrides": [] },
|
||||
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
|
||||
"gridPos": { "h": 8, "w": 24, "x": 0, "y": 0 }
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "timeseries",
|
||||
"title": "Collector exporter queue size",
|
||||
"description": "Bounded exporter queues, sourced from the Collector's own Prometheus endpoint.",
|
||||
"datasource": { "type": "prometheus", "uid": "prometheus" },
|
||||
"title": "HTTP RPS",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum(rate(messenger_http_requests_total{route!~\"/health/.*\"}[1m]))",
|
||||
"legendFormat": "series 1"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "timeseries",
|
||||
"title": "HTTP 5xx ratio",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum(rate(messenger_http_requests_total{status_class=\"5xx\",route!~\"/health/.*\"}[1m])) / clamp_min(sum(rate(messenger_http_requests_total{route!~\"/health/.*\"}[1m])),0.001)",
|
||||
"legendFormat": "series 1"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "timeseries",
|
||||
"title": "HTTP p50/p95/p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.50,sum by(le)(rate(messenger_http_duration_seconds_bucket{route!~\"/health/.*\"}[5m])))",
|
||||
"legendFormat": "series 1"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95,sum by(le)(rate(messenger_http_duration_seconds_bucket{route!~\"/health/.*\"}[5m])))",
|
||||
"legendFormat": "series 2"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99,sum by(le)(rate(messenger_http_duration_seconds_bucket{route!~\"/health/.*\"}[5m])))",
|
||||
"legendFormat": "series 3"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "timeseries",
|
||||
"title": "Job outcomes",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by(outcome)(rate(messenger_jobs_processed_total[1m]))",
|
||||
"legendFormat": "{{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 16
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "timeseries",
|
||||
"title": "Job p95/p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.95,sum by(le)(rate(messenger_jobs_duration_seconds_bucket[5m])))",
|
||||
"legendFormat": "series 1"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.99,sum by(le)(rate(messenger_jobs_duration_seconds_bucket[5m])))",
|
||||
"legendFormat": "series 2"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 16
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"type": "timeseries",
|
||||
"title": "Queue depth",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum(messenger_queue_depth{queue_name=\"attachments.process\"} and (time()-timestamp(messenger_queue_depth{queue_name=\"attachments.process\"})<15))",
|
||||
"legendFormat": "series 1"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 24
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": "timeseries",
|
||||
"title": "Oldest queued job",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "max(messenger_queue_oldest_age_seconds{queue_name=\"attachments.process\"} and (time()-timestamp(messenger_queue_oldest_age_seconds{queue_name=\"attachments.process\"})<15))",
|
||||
"legendFormat": "series 1"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 24
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"type": "timeseries",
|
||||
"title": "DB pool used / waiting",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by(service_name)(messenger_db_pool_used)",
|
||||
"legendFormat": "series 1"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "sum by(service_name)(messenger_db_pool_waiting)",
|
||||
"legendFormat": "series 2"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 32
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"type": "timeseries",
|
||||
"title": "Worker busy / capacity",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum(messenger_worker_busy)",
|
||||
"legendFormat": "series 1"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "sum(messenger_worker_capacity)",
|
||||
"legendFormat": "series 2"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 32
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"type": "timeseries",
|
||||
"title": "Time to ready p50/p95/p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.50,sum by(le)(rate(messenger_attachments_ready_duration_seconds_bucket[5m])))",
|
||||
"legendFormat": "series 1"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95,sum by(le)(rate(messenger_attachments_ready_duration_seconds_bucket[5m])))",
|
||||
"legendFormat": "series 2"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99,sum by(le)(rate(messenger_attachments_ready_duration_seconds_bucket[5m])))",
|
||||
"legendFormat": "series 3"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 40
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"type": "timeseries",
|
||||
"title": "Process CPU",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by(service_name)(rate(messenger_process_cpu_time_seconds_total[1m]))",
|
||||
"legendFormat": "series 1"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 40
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"type": "timeseries",
|
||||
"title": "Process RSS",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by(service_name)(messenger_process_rss_bytes)",
|
||||
"legendFormat": "series 1"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 48
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"type": "timeseries",
|
||||
"title": "Collector queue / failures",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "otelcol_exporter_queue_size{job=\"otel-collector\"}",
|
||||
"legendFormat": "{{exporter}}"
|
||||
"legendFormat": "series 1"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "sum(rate(otelcol_exporter_send_failed_metric_points_total[1m]))",
|
||||
"legendFormat": "series 2"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "sum(rate(otelcol_exporter_send_failed_log_records_total[1m]))",
|
||||
"legendFormat": "series 3"
|
||||
},
|
||||
{
|
||||
"refId": "D",
|
||||
"expr": "sum(rate(otelcol_exporter_send_failed_spans_total[1m]))",
|
||||
"legendFormat": "series 4"
|
||||
}
|
||||
],
|
||||
"fieldConfig": { "defaults": { "min": 0 }, "overrides": [] },
|
||||
"options": { "legend": { "displayMode": "list", "placement": "bottom" } },
|
||||
"gridPos": { "h": 8, "w": 24, "x": 0, "y": 8 }
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 48
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"type": "timeseries",
|
||||
"title": "Alerts firing",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "ALERTS{alertstate=\"firing\",alertname=~\"Lab6.*\"}",
|
||||
"legendFormat": "{{alertname}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 56
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
scrape_interval: 5s
|
||||
evaluation_interval: 5s
|
||||
|
||||
rule_files:
|
||||
- /etc/prometheus/rules.yml
|
||||
|
||||
scrape_configs:
|
||||
- job_name: prometheus
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
groups:
|
||||
- name: lab6-operational
|
||||
interval: 5s
|
||||
rules:
|
||||
- alert: Lab6HighHttpErrorRate
|
||||
expr: |
|
||||
sum(rate(messenger_http_requests_total{status_class="5xx",route!~"/health/.*"}[30s]))
|
||||
/ clamp_min(sum(rate(messenger_http_requests_total{route!~"/health/.*"}[30s])), 0.001) > 0.10
|
||||
for: 10s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: More than 10% of business HTTP requests return 5xx
|
||||
runbook: See infra/runbooks/incident.md#http-errors
|
||||
- alert: Lab6QueueLag
|
||||
expr: |
|
||||
(messenger_queue_oldest_age_seconds{queue_name="attachments.process"}
|
||||
and (time() - timestamp(messenger_queue_oldest_age_seconds{queue_name="attachments.process"}) < 15)) > 10
|
||||
for: 10s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: Oldest queued image job is over 10 seconds old
|
||||
runbook: See infra/runbooks/incident.md#queue-lag
|
||||
- name: lab6-slo-burn
|
||||
interval: 5s
|
||||
rules:
|
||||
- alert: Lab6ApiBurnShort
|
||||
expr: |
|
||||
((sum(rate(messenger_http_requests_total{status_class="5xx",route!~"/health/.*"}[15s])) or vector(0))
|
||||
/ clamp_min(sum(rate(messenger_http_requests_total{route!~"/health/.*"}[15s])),0.001) > 0.144)
|
||||
and
|
||||
((sum(rate(messenger_http_requests_total{status_class="5xx",route!~"/health/.*"}[30s])) or vector(0))
|
||||
/ clamp_min(sum(rate(messenger_http_requests_total{route!~"/health/.*"}[30s])),0.001) > 0.144)
|
||||
for: 10s
|
||||
labels:
|
||||
severity: page
|
||||
slo: api
|
||||
window: short
|
||||
annotations:
|
||||
summary: API error budget burning over 14.4x in both 15s and 30s windows
|
||||
runbook: See infra/runbooks/incident.md#http-errors
|
||||
- alert: Lab6ApiBurnLong
|
||||
expr: |
|
||||
((sum(rate(messenger_http_requests_total{status_class="5xx",route!~"/health/.*"}[60s])) or vector(0))
|
||||
/ clamp_min(sum(rate(messenger_http_requests_total{route!~"/health/.*"}[60s])),0.001) > 0.06)
|
||||
and
|
||||
((sum(rate(messenger_http_requests_total{status_class="5xx",route!~"/health/.*"}[120s])) or vector(0))
|
||||
/ clamp_min(sum(rate(messenger_http_requests_total{route!~"/health/.*"}[120s])),0.001) > 0.06)
|
||||
for: 10s
|
||||
labels:
|
||||
severity: warning
|
||||
slo: api
|
||||
window: long
|
||||
annotations:
|
||||
summary: API error budget burning over 6x in both 60s and 120s windows
|
||||
runbook: See infra/runbooks/incident.md#http-errors
|
||||
- alert: Lab6ReadyBurnShort
|
||||
expr: |
|
||||
((sum(rate(messenger_attachments_ready_duration_seconds_count[15s]))
|
||||
- sum(rate(messenger_attachments_ready_duration_seconds_bucket{le="5"}[15s])))
|
||||
/ clamp_min(sum(rate(messenger_attachments_ready_duration_seconds_count[15s])),0.001) > 0.72)
|
||||
and
|
||||
((sum(rate(messenger_attachments_ready_duration_seconds_count[30s]))
|
||||
- sum(rate(messenger_attachments_ready_duration_seconds_bucket{le="5"}[30s])))
|
||||
/ clamp_min(sum(rate(messenger_attachments_ready_duration_seconds_count[30s])),0.001) > 0.72)
|
||||
for: 10s
|
||||
labels:
|
||||
severity: page
|
||||
slo: ready
|
||||
window: short
|
||||
annotations:
|
||||
summary: Ready-time error budget burning over 14.4x in both 15s and 30s windows
|
||||
runbook: See infra/runbooks/incident.md#queue-lag
|
||||
- alert: Lab6ReadyBurnLong
|
||||
expr: |
|
||||
((sum(rate(messenger_attachments_ready_duration_seconds_count[60s]))
|
||||
- sum(rate(messenger_attachments_ready_duration_seconds_bucket{le="5"}[60s])))
|
||||
/ clamp_min(sum(rate(messenger_attachments_ready_duration_seconds_count[60s])),0.001) > 0.30)
|
||||
and
|
||||
((sum(rate(messenger_attachments_ready_duration_seconds_count[120s]))
|
||||
- sum(rate(messenger_attachments_ready_duration_seconds_bucket{le="5"}[120s])))
|
||||
/ clamp_min(sum(rate(messenger_attachments_ready_duration_seconds_count[120s])),0.001) > 0.30)
|
||||
for: 10s
|
||||
labels:
|
||||
severity: warning
|
||||
slo: ready
|
||||
window: long
|
||||
annotations:
|
||||
summary: Ready-time error budget burning over 6x in both 60s and 120s windows
|
||||
runbook: See infra/runbooks/incident.md#queue-lag
|
||||
@@ -0,0 +1,54 @@
|
||||
# Lab 6: local incident runbook
|
||||
|
||||
Use Grafana at `http://localhost:3000` (dashboard **Lab 6 · Messenger signals**) or
|
||||
Prometheus rules at `/alerts` inside the Compose network. All times below are
|
||||
UTC. The dashboard uses stored Prometheus data; Tempo and Loki are separate
|
||||
datasources. Keep the last hour visible before diagnosing a recovered incident.
|
||||
|
||||
## HTTP errors
|
||||
|
||||
`Lab6HighHttpErrorRate` fires when 5xx / all non-health HTTP requests exceeds
|
||||
10% over 30 seconds for another 10 seconds. Client 4xx are in the denominator
|
||||
and have a separate panel; they are not server failures. Check HTTP RPS first:
|
||||
an empty or tiny denominator makes an error ratio unreliable. Compare 5xx
|
||||
ratio with DB pool used/waiting and `up` for the telemetry stores. In Tempo,
|
||||
find an `HTTP` server span in the time range and inspect its `db.*` child span
|
||||
duration/status. Query Loki `{service_name="messenger-api"}` for the same
|
||||
trace ID. A growing pool wait and failing DB span identify a database incident;
|
||||
a long server span with fast DB children points to the application path.
|
||||
Restart PostgreSQL only after confirming its container state and persistent
|
||||
volume. Confirm `up`, 5xx ratio, and `/health/ready` recover; record first
|
||||
`pending`, `firing`, and `inactive` timestamps from the rule API.
|
||||
|
||||
## Queue lag
|
||||
|
||||
`Lab6QueueLag` fires when the oldest durable queued job exceeds 10 seconds for
|
||||
another 10 seconds. `messenger_queue_depth` counts rows with `status='queued'`
|
||||
in PostgreSQL, including an outbox row awaiting publication. It is sampled by
|
||||
the publisher. First compare queue depth, oldest age, `messenger_worker_busy`
|
||||
and `messenger_worker_capacity`. If busy disappears and capacity is absent,
|
||||
inspect the worker container; if capacity is present but processing outcome
|
||||
rates stop, inspect broker connectivity and `job_published` events in Loki.
|
||||
If jobs fail repeatedly, inspect `messenger_jobs_processed_total` grouped by
|
||||
outcome and the corresponding consumer trace; do not replay until the cause
|
||||
is corrected. Restart the worker, then verify queued count/age fall, ready
|
||||
durations appear, and the alert returns to inactive.
|
||||
|
||||
## Follow an upload
|
||||
|
||||
Take the `trace_id` from the API `attachment_uploaded` log in Loki. Tempo
|
||||
should contain the API upload span, publisher `attachments.publish` producer
|
||||
span, worker `attachments.process` consumer span and its S3/render/DB children.
|
||||
The worker `job_processed` log has the same trace ID. Job identifiers are
|
||||
synthetic test identifiers; metric labels contain only route templates,
|
||||
status classes, job type/outcome and queue name. Never copy request bodies,
|
||||
tokens, signed object URLs or raw image bytes into evidence.
|
||||
|
||||
## Missing telemetry
|
||||
|
||||
If a signal is absent, check Collector `otelcol_exporter_queue_size`,
|
||||
`otelcol_exporter_send_failed_*` and store `up` before concluding the business
|
||||
service recovered. The SDK uses asynchronous bounded queues and 2-second
|
||||
export timeouts; Collector queues are finite. Export loss during a backend
|
||||
outage is expected and must be reported. A missing sample is not zero errors.
|
||||
Telemetry stores are not part of API readiness.
|
||||
Reference in New Issue
Block a user