лаба на 4
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
],
|
||||
"timezone": "browser",
|
||||
"schemaVersion": 39,
|
||||
"version": 1,
|
||||
"version": 2,
|
||||
"editable": false,
|
||||
"refresh": "10s",
|
||||
"time": {
|
||||
@@ -338,6 +338,586 @@
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"title": "HTTP Latency Percentiles",
|
||||
"description": "Business request latency across both API replicas",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route=~\"/api/.*\"}[$__rate_interval])))",
|
||||
"legendFormat": "p50",
|
||||
"range": true
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route=~\"/api/.*\"}[$__rate_interval])))",
|
||||
"legendFormat": "p95",
|
||||
"range": true
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route=~\"/api/.*\"}[$__rate_interval])))",
|
||||
"legendFormat": "p99",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"title": "HTTP Error Ratio",
|
||||
"description": "5xx divided by all business API requests; health excluded",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "100 * (sum(rate(messenger_http_requests_total{route=~\"/api/.*\",status_code=~\"5..\"}[$__rate_interval])) or (0 * sum(rate(messenger_http_requests_total{route=~\"/api/.*\"}[$__rate_interval])))) / (sum(rate(messenger_http_requests_total{route=~\"/api/.*\"}[$__rate_interval])) > 0)",
|
||||
"legendFormat": "5xx ratio",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percent",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"title": "Queue Backlog",
|
||||
"description": "Durable queued attachment jobs",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "max by (queue_name) (messenger_queue_depth)",
|
||||
"legendFormat": "{{queue_name}}",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"title": "Oldest Queued Job Age",
|
||||
"description": "Age of oldest queued attachment job",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "max by (queue_name) (messenger_queue_oldest_age_seconds)",
|
||||
"legendFormat": "{{queue_name}}",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"title": "Database Pool Used / Capacity",
|
||||
"description": "Checked-out connections and maximum capacity per process",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "messenger_db_pool_used",
|
||||
"legendFormat": "Used {{service_name}} {{service_instance_id}}",
|
||||
"range": true
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "messenger_db_pool_capacity",
|
||||
"legendFormat": "Capacity {{service_name}} {{service_instance_id}}",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"title": "Database Pool Waiting",
|
||||
"description": "Connection acquisitions waiting on the pool queue",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "messenger_db_pool_waiting",
|
||||
"legendFormat": "{{service_name}} {{service_instance_id}}",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"title": "Worker Busy / Capacity",
|
||||
"description": "Concurrent active processing attempts and worker capacity",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "messenger_worker_busy",
|
||||
"legendFormat": "Busy",
|
||||
"range": true
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "messenger_worker_capacity",
|
||||
"legendFormat": "Capacity",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"title": "Process CPU",
|
||||
"description": "CPU utilization per process; 100% equals one CPU core",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "messenger_process_cpu_percent",
|
||||
"legendFormat": "{{service_name}} {{service_instance_id}}",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percent",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"title": "Process RAM",
|
||||
"description": "Resident memory per application process",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "messenger_process_memory_bytes",
|
||||
"legendFormat": "{{service_name}} {{service_instance_id}}",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"title": "Attachment End-to-End Time",
|
||||
"description": "Time from durable acceptance to committed ready state",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_attachment_ready_duration_seconds_bucket[$__rate_interval])))",
|
||||
"legendFormat": "p50",
|
||||
"range": true
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_attachment_ready_duration_seconds_bucket[$__rate_interval])))",
|
||||
"legendFormat": "p95",
|
||||
"range": true
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_attachment_ready_duration_seconds_bucket[$__rate_interval])))",
|
||||
"legendFormat": "p99",
|
||||
"range": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "auto"
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -11,25 +11,52 @@ processors:
|
||||
check_interval: 1s
|
||||
limit_mib: 192
|
||||
spike_limit_mib: 48
|
||||
|
||||
batch:
|
||||
timeout: 2s
|
||||
send_batch_size: 512
|
||||
send_batch_max_size: 1024
|
||||
|
||||
exporters:
|
||||
prometheus:
|
||||
endpoint: 0.0.0.0:8889
|
||||
metric_expiration: 30s
|
||||
resource_to_telemetry_conversion:
|
||||
enabled: true
|
||||
|
||||
otlp/tempo:
|
||||
endpoint: tempo:4317
|
||||
timeout: 5s
|
||||
tls:
|
||||
insecure: true
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 128
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 5s
|
||||
max_elapsed_time: 30s
|
||||
|
||||
otlphttp/loki:
|
||||
endpoint: http://loki:3100/otlp
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 128
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 5s
|
||||
max_elapsed_time: 30s
|
||||
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
# Регламент диагностики и устранения инцидентов
|
||||
|
||||
## SLI / SLO
|
||||
|
||||
- SLO доступности API: не менее 99% за 30 дней.
|
||||
- SLO задержки: не менее 95% бизнес-запросов выполняются за 500 мс за 30 дней.
|
||||
- SLI доступности: 1 - количество HTTP 5xx / общее количество бизнес-запросов.
|
||||
- SLI задержки: доля бизнес-запросов, выполненных не более чем за 500 мс.
|
||||
- Запросы к health endpoints исключаются из расчётов.
|
||||
- При отсутствии запросов показатели не оцениваются.
|
||||
- Для демонстрации инцидентов используются сокращённые окна наблюдения.
|
||||
|
||||
## Ошибки HTTP
|
||||
|
||||
<a id="http-errors"></a>
|
||||
|
||||
Алерт: MessengerHighHTTPErrorRate.
|
||||
|
||||
Условие срабатывания: доля HTTP 5xx превышает 1%
|
||||
за последнюю минуту в течение 15 секунд.
|
||||
|
||||
### Диагностика
|
||||
|
||||
1. Проверить долю ошибок и задержки HTTP-запросов в Grafana.
|
||||
2. Проверить доступность PostgreSQL и состояние пула соединений.
|
||||
3. Найти логи ошибочных запросов в Loki.
|
||||
4. Открыть соответствующие трассировки в Tempo.
|
||||
5. Определить причину ошибки или замедления.
|
||||
|
||||
### Восстановление
|
||||
|
||||
Восстановить работоспособность проблемного сервиса.
|
||||
Проверить готовность API, выполнить smoke-тесты
|
||||
и убедиться, что алерт перешёл в неактивное состояние.
|
||||
|
||||
## Задержка очереди
|
||||
|
||||
<a id="queue-lag"></a>
|
||||
|
||||
Алерт: MessengerQueueLag.
|
||||
|
||||
Условие срабатывания: возраст самой старой задачи
|
||||
в очереди превышает 30 секунд в течение 15 секунд.
|
||||
|
||||
### Диагностика
|
||||
|
||||
1. Проверить глубину очереди и возраст самой старой задачи.
|
||||
2. Проверить доступность и загрузку worker.
|
||||
3. Проверить очереди и потребителей RabbitMQ.
|
||||
4. Изучить логи dispatcher и worker в Loki.
|
||||
5. Проверить трассировки обработки вложений в Tempo.
|
||||
|
||||
### Восстановление
|
||||
|
||||
Восстановить работу worker или проблемного сервиса.
|
||||
Убедиться, что очередь сокращается, вложения переходят
|
||||
в состояние ready, а алерт становится неактивным.
|
||||
|
||||
## Отказ системы сбора телеметрии
|
||||
|
||||
### Диагностика
|
||||
|
||||
1. Проверить доступность Tempo и Loki.
|
||||
2. Проверить потребление памяти OpenTelemetry Collector.
|
||||
3. Проверить размер и ёмкость очередей экспортёров.
|
||||
4. Проверить количество ошибок экспорта и потерь телеметрии.
|
||||
5. Убедиться, что бизнес-API продолжает работать.
|
||||
|
||||
### Восстановление
|
||||
|
||||
Восстановить доступность проблемного backend.
|
||||
Убедиться, что очереди экспортёров сокращаются,
|
||||
отправка телеметрии возобновилась, а API работает корректно.
|
||||
Зафиксировать количество потерянной телеметрии.
|
||||
@@ -2,12 +2,20 @@ global:
|
||||
scrape_interval: 5s
|
||||
evaluation_interval: 5s
|
||||
|
||||
rule_files:
|
||||
- /etc/prometheus/rules.yml
|
||||
|
||||
scrape_configs:
|
||||
- job_name: otel-collector
|
||||
static_configs:
|
||||
- targets:
|
||||
- otel-collector:8889
|
||||
|
||||
- job_name: otel-collector-internal
|
||||
static_configs:
|
||||
- targets:
|
||||
- otel-collector:8888
|
||||
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets:
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
groups:
|
||||
- name: messenger-sli
|
||||
interval: 5s
|
||||
rules:
|
||||
- record: messenger:sli_http_error_ratio:1m
|
||||
expr: |
|
||||
(
|
||||
sum(rate(messenger_http_requests_total{route=~"/api/.*",status_class="5xx"}[1m]))
|
||||
or vector(0)
|
||||
)
|
||||
/
|
||||
sum(rate(messenger_http_requests_total{route=~"/api/.*"}[1m]))
|
||||
|
||||
- record: messenger:sli_http_availability:1m
|
||||
expr: |
|
||||
1 - messenger:sli_http_error_ratio:1m
|
||||
|
||||
- record: messenger:sli_http_p95_seconds:1m
|
||||
expr: |
|
||||
histogram_quantile(
|
||||
0.95,
|
||||
sum by (le) (
|
||||
rate(messenger_http_request_duration_seconds_bucket{route=~"/api/.*"}[1m])
|
||||
)
|
||||
)
|
||||
|
||||
- record: messenger:sli_http_latency_good_ratio:1m
|
||||
expr: |
|
||||
sum(rate(messenger_http_request_duration_seconds_bucket{route=~"/api/.*",le="0.5"}[1m]))
|
||||
/
|
||||
sum(rate(messenger_http_request_duration_seconds_count{route=~"/api/.*"}[1m]))
|
||||
|
||||
- name: messenger-alerts
|
||||
interval: 5s
|
||||
rules:
|
||||
- alert: MessengerHighHTTPErrorRate
|
||||
expr: |
|
||||
messenger:sli_http_error_ratio:1m > 0.01
|
||||
for: 15s
|
||||
labels:
|
||||
severity: critical
|
||||
annotations:
|
||||
summary: "HTTP 5xx error ratio exceeds 1%"
|
||||
description: "Business API error ratio is {{ $value }}"
|
||||
runbook: "infra/prometheus/RUNBOOK.md#http-errors"
|
||||
|
||||
- alert: MessengerQueueLag
|
||||
expr: |
|
||||
max by (queue_name) (
|
||||
messenger_queue_oldest_age_seconds
|
||||
) > 30
|
||||
for: 15s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: "Attachment queue lag exceeds 30 seconds"
|
||||
description: "Oldest pending job age is {{ $value }} seconds"
|
||||
runbook: "infra/prometheus/RUNBOOK.md#queue-lag"
|
||||
Reference in New Issue
Block a user