feat: ЛР6 - наблюдаемость OpenTelemetry, Grafana и исследование цены наблюдаемости

This commit is contained in:
Ильяс
2026-11-27 20:09:36 +03:00
parent 38a00e1930
commit c549409d7b
25 changed files with 2599 additions and 187 deletions
@@ -0,0 +1,229 @@
apiVersion: 1
contactPoints:
- orgId: 1
name: default-channel
receivers:
- uid: default-channel
type: email
settings:
addresses: admin@example.com
policies:
- orgId: 1
receiver: default-channel
group_by: ['alertname', 'grafana_folder']
groups:
- orgId: 1
name: messenger_alerts
folder: Messenger Alerts
interval: 10s
rules:
- uid: high_http_error_rate
title: HighHttpErrorRate
condition: C
for: 1m
noDataState: OK
execErrState: Error
data:
- refId: A
relativeTimeRange:
from: 300
to: 0
datasourceUid: prometheus
model:
editorMode: code
expr: ((sum(rate(messenger_http_requests_total{status=~"5.."}[1m])) or vector(0)) / (sum(rate(messenger_http_requests_total[1m])) or vector(1))) > 0.05
instant: true
range: false
refId: A
- refId: C
relativeTimeRange:
from: 300
to: 0
datasourceUid: __expr__
model:
conditions:
- eval:
params:
- 0
type: gt
operator:
type: and
query:
params:
- A
reducer:
params: []
type: last
type: query
datasource:
name: Expression
type: __expr__
uid: __expr__
expression: A
refId: C
type: threshold
annotations:
summary: High HTTP 5xx error rate detected
description: More than 5% of requests returned 5xx status codes over the last minute.
runbook_url: file:///RUNBOOK.md#highhttperrorrate
labels:
severity: critical
- uid: queue_lag_growing
title: QueueLagGrowing
condition: C
for: 1m
noDataState: OK
execErrState: Error
data:
- refId: A
relativeTimeRange:
from: 300
to: 0
datasourceUid: prometheus
model:
editorMode: code
expr: (messenger_queue_depth or vector(0)) > 10
instant: true
range: false
refId: A
- refId: C
relativeTimeRange:
from: 300
to: 0
datasourceUid: __expr__
model:
conditions:
- eval:
params:
- 0
type: gt
operator:
type: and
query:
params:
- A
reducer:
params: []
type: last
type: query
datasource:
name: Expression
type: __expr__
uid: __expr__
expression: A
refId: C
type: threshold
annotations:
summary: Worker queue depth is growing
description: RabbitMQ task queue depth has exceeded 10 messages for over 1 minute.
runbook_url: file:///RUNBOOK.md#queuelaggrowing
labels:
severity: warning
- uid: high_http_latency_p95
title: HighHttpLatencyP95
condition: C
for: 1m
noDataState: OK
execErrState: Error
data:
- refId: A
relativeTimeRange:
from: 300
to: 0
datasourceUid: prometheus
model:
editorMode: code
expr: (histogram_quantile(0.95, sum(rate(messenger_http_request_duration_seconds_bucket[1m])) by (le)) or vector(0)) > 1.0
instant: true
range: false
refId: A
- refId: C
relativeTimeRange:
from: 300
to: 0
datasourceUid: __expr__
model:
conditions:
- eval:
params:
- 0
type: gt
operator:
type: and
query:
params:
- A
reducer:
params: []
type: last
type: query
datasource:
name: Expression
type: __expr__
uid: __expr__
expression: A
refId: C
type: threshold
annotations:
summary: HTTP request latency p95 exceeded 1 second
description: 95th percentile of request duration is higher than 1s over the last minute.
runbook_url: file:///RUNBOOK.md#highhttplatencyp95
labels:
severity: warning
- uid: worker_job_failure_rate
title: WorkerJobFailureRate
condition: C
for: 1m
noDataState: OK
execErrState: Error
data:
- refId: A
relativeTimeRange:
from: 300
to: 0
datasourceUid: prometheus
model:
editorMode: code
expr: (sum(rate(messenger_jobs_failed_total[1m])) or vector(0)) > 0.05
instant: true
range: false
refId: A
- refId: C
relativeTimeRange:
from: 300
to: 0
datasourceUid: __expr__
model:
conditions:
- eval:
params:
- 0
type: gt
operator:
type: and
query:
params:
- A
reducer:
params: []
type: last
type: query
datasource:
name: Expression
type: __expr__
uid: __expr__
expression: A
refId: C
type: threshold
annotations:
summary: Worker job failure rate elevated
description: Attachment worker is encountering permanent task failures.
runbook_url: file:///RUNBOOK.md#workerjobfailurerate
labels:
severity: critical
@@ -0,0 +1,12 @@
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: true
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,43 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
jsonData:
httpMethod: POST
timeInterval: 5s
- name: Tempo
type: tempo
access: proxy
url: http://tempo:3200
jsonData:
httpMethod: GET
tracesToLogsV2:
datasourceUid: 'loki'
tags: ['job', 'instance', 'service.name']
filterByTraceID: true
filterBySpanID: true
serviceMap:
datasourceUid: 'prometheus'
nodeGraph:
enabled: true
search:
hide: false
lokiSearch:
datasourceUid: 'loki'
- name: Loki
type: loki
access: proxy
url: http://loki:3100
jsonData:
maxLines: 1000
derivedFields:
- datasourceUid: tempo
matcherRegex: '"trace_id":\s*"([0-9a-f]{32})"'
name: TraceID
url: '$${__value.raw}'