Lab 6: track - 1

This commit is contained in:
2026-11-23 14:54:48 +03:00
parent 470d9d6f1e
commit a271ddd156
39 changed files with 3141 additions and 15 deletions
@@ -0,0 +1,137 @@
apiVersion: 1
groups:
- orgId: 1
name: messenger-slo-alerts
folder: Messenger
interval: 10s
rules:
- uid: messenger-high-5xx
title: High API 5xx Error Ratio (>5%)
condition: C
for: 15s
noDataState: OK
execErrState: Error
annotations:
summary: High 5xx error ratio on business routes
description: 5xx error ratio exceeded 5% over 1m window. See infra/otel/RUNBOOKS.md.
labels:
severity: critical
data:
- refId: A
relativeTimeRange:
from: 120
to: 0
datasourceUid: prometheus
model:
datasource:
type: prometheus
uid: prometheus
expr: sum(rate(http_server_requests_total{service_name="messenger-api",http_route!~"/health/.*",http_response_status_class="5xx"}[1m])) / clamp_min(sum(rate(http_server_requests_total{service_name="messenger-api",http_route!~"/health/.*"}[1m])), 0.001)
instant: true
intervalMs: 1000
maxDataPoints: 43200
refId: A
- refId: B
relativeTimeRange:
from: 120
to: 0
datasourceUid: __expr__
model:
datasource:
type: __expr__
uid: __expr__
expression: A
reducer: last
type: reduce
refId: B
- refId: C
relativeTimeRange:
from: 120
to: 0
datasourceUid: __expr__
model:
datasource:
type: __expr__
uid: __expr__
expression: B
type: threshold
conditions:
- evaluator:
params:
- 0.05
type: gt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
refId: C
- uid: messenger-queue-lag
title: Growing Attachment Queue Lag (>15s)
condition: C
for: 15s
noDataState: OK
execErrState: Error
annotations:
summary: Oldest unfinished attachment job age > 15s
description: Worker stopped or overloaded. Check worker saturation and DLQ. See infra/otel/RUNBOOKS.md.
labels:
severity: warning
data:
- refId: A
relativeTimeRange:
from: 120
to: 0
datasourceUid: prometheus
model:
datasource:
type: prometheus
uid: prometheus
expr: max(worker_oldest_job_age_seconds{queue_name="attachment-jobs"})
instant: true
intervalMs: 1000
maxDataPoints: 43200
refId: A
- refId: B
relativeTimeRange:
from: 120
to: 0
datasourceUid: __expr__
model:
datasource:
type: __expr__
uid: __expr__
expression: A
reducer: last
type: reduce
refId: B
- refId: C
relativeTimeRange:
from: 120
to: 0
datasourceUid: __expr__
model:
datasource:
type: __expr__
uid: __expr__
expression: B
type: threshold
conditions:
- evaluator:
params:
- 15
type: gt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
refId: C
@@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: Messenger
orgId: 1
folder: Messenger
type: file
disableDeletion: false
editable: true
updateIntervalSeconds: 10
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,41 @@
apiVersion: 1
datasources:
- name: Prometheus
uid: prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: false
jsonData:
timeInterval: 5s
- name: Loki
uid: loki
type: loki
access: proxy
url: http://loki:3100
editable: false
jsonData:
derivedFields:
- datasourceUid: tempo
matcherType: label
matcherRegex: "trace_id"
name: TraceID
url: "$${__value.raw}"
- name: Tempo
uid: tempo
type: tempo
access: proxy
url: http://tempo:3200
editable: false
jsonData:
tracesToLogsV2:
datasourceUid: loki
spanStartTimeShift: '-1m'
spanEndTimeShift: '1m'
filterByTraceID: true
filterBySpanID: false
nodeGraph:
enabled: true
search:
hide: false