Files
mtusi2026lab6/infra/grafana/provisioning/alerting/rules.yaml
T

121 lines
3.8 KiB
YAML

apiVersion: 1
groups:
- orgId: 1
name: Messenger SLO alerts
folder: MTUSI Lab 6
interval: 10s
rules:
- uid: messenger-api-high-error-rate
title: ApiHighServerErrorRate
condition: C
data:
- refId: A
relativeTimeRange:
from: 120
to: 0
datasourceUid: prometheus
model:
datasource:
type: prometheus
uid: prometheus
editorMode: code
expr: '(sum(rate(http_server_request_count_total{service_name="messenger-api",http_route!~"/health/.*",http_response_status_class="5xx"}[2m])) / clamp_min(sum(rate(http_server_request_count_total{service_name="messenger-api",http_route!~"/health/.*"}[2m])), 0.001)) or vector(0)'
instant: true
intervalMs: 1000
maxDataPoints: 43200
range: false
refId: A
- refId: C
relativeTimeRange:
from: 0
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params: [0.05]
type: gt
operator:
type: and
query:
params: [C]
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
refId: C
type: threshold
dashboardUid: messenger-observability
panelId: 2
noDataState: OK
execErrState: Error
for: 1m
annotations:
summary: Более 5% бизнес-запросов завершаются 5xx.
runbook_url: /var/lib/grafana/runbooks/api-high-error-rate.md
labels:
service: messenger-api
severity: warning
isPaused: false
- uid: messenger-queue-oldest-growing
title: QueueOldestJobGrowing
condition: C
data:
- refId: A
relativeTimeRange:
from: 60
to: 0
datasourceUid: prometheus
model:
datasource:
type: prometheus
uid: prometheus
editorMode: code
expr: '(max(messenger_queue_oldest_age_seconds{messaging_destination_name="attachments.process"}) > 20 and max(messenger_queue_depth{messaging_destination_name="attachments.process"}) > 0) or vector(0)'
instant: true
intervalMs: 1000
maxDataPoints: 43200
range: false
refId: A
- refId: C
relativeTimeRange:
from: 0
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params: [0.5]
type: gt
operator:
type: and
query:
params: [C]
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
refId: C
type: threshold
dashboardUid: messenger-observability
panelId: 7
noDataState: OK
execErrState: Error
for: 15s
annotations:
summary: Возраст старейшей незавершённой job превысил 20 секунд.
runbook_url: /var/lib/grafana/runbooks/queue-oldest-job.md
labels:
service: messenger-worker
severity: warning
isPaused: false