ЛР6: OTel SDK, Collector, Prometheus/Loki/Tempo, Grafana, alerts, dashboard, тесты инцидентов
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"annotations": {"list": []},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 1,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{"type":"row","title":"API HTTP","gridPos":{"h":1,"w":24,"x":0,"y":0},"collapsed":false,"panels":[]},
|
||||
{"type":"timeseries","title":"RPS по route template","gridPos":{"h":8,"w":12,"x":0,"y":1},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"reqps","custom":{"drawStyle":"line","fillOpacity":10}},"overrides":[]},
|
||||
"targets":[{"expr":"sum by (http_target) (rate(http_server_duration_milliseconds_count{http_target!~\"/health/.*\"}[1m]))","legendFormat":"{{http_target}}"}]},
|
||||
{"type":"timeseries","title":"Error ratio (5xx / всё, health исключён)","gridPos":{"h":8,"w":12,"x":12,"y":1},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"percentunit","custom":{"drawStyle":"line","fillOpacity":10}},"overrides":[]},
|
||||
"targets":[{"expr":"(sum(rate(http_server_duration_milliseconds_count{http_status_code=~\"5..\",http_target!~\"/health/.*\"}[2m])) or vector(0)) / sum(rate(http_server_duration_milliseconds_count{http_target!~\"/health/.*\"}[2m]))","legendFormat":"5xx ratio"}]},
|
||||
{"type":"timeseries","title":"Latency p50/p95/p99 (API, ms)","gridPos":{"h":8,"w":24,"x":0,"y":9},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"ms","custom":{"drawStyle":"line","fillOpacity":0}},"overrides":[]},
|
||||
"targets":[
|
||||
{"expr":"histogram_quantile(0.50, sum by (le) (rate(http_server_duration_milliseconds_bucket{http_target!~\"/health/.*\"}[2m])))","legendFormat":"p50"},
|
||||
{"expr":"histogram_quantile(0.95, sum by (le) (rate(http_server_duration_milliseconds_bucket{http_target!~\"/health/.*\"}[2m])))","legendFormat":"p95"},
|
||||
{"expr":"histogram_quantile(0.99, sum by (le) (rate(http_server_duration_milliseconds_bucket{http_target!~\"/health/.*\"}[2m])))","legendFormat":"p99"}
|
||||
]},
|
||||
{"type":"row","title":"Worker / Queue","gridPos":{"h":1,"w":24,"x":0,"y":17},"collapsed":false,"panels":[]},
|
||||
{"type":"timeseries","title":"Jobs по outcome (rate, 1m)","gridPos":{"h":8,"w":12,"x":0,"y":18},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"ops","custom":{"drawStyle":"line","fillOpacity":10}},"overrides":[]},
|
||||
"targets":[{"expr":"sum by (outcome) (rate(messenger_jobs_processed_total[1m]))","legendFormat":"{{outcome}}"}]},
|
||||
{"type":"timeseries","title":"Job processing duration p50/p95/p99 (s)","gridPos":{"h":8,"w":12,"x":12,"y":18},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"s","custom":{"drawStyle":"line","fillOpacity":0}},"overrides":[]},
|
||||
"targets":[
|
||||
{"expr":"histogram_quantile(0.50, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket[5m])))","legendFormat":"p50"},
|
||||
{"expr":"histogram_quantile(0.95, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket[5m])))","legendFormat":"p95"},
|
||||
{"expr":"histogram_quantile(0.99, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket[5m])))","legendFormat":"p99"}
|
||||
]},
|
||||
{"type":"timeseries","title":"Queue depth (queued)","gridPos":{"h":8,"w":8,"x":0,"y":26},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"short","custom":{"drawStyle":"line","fillOpacity":10}},"overrides":[]},
|
||||
"targets":[{"expr":"sum(messenger_queue_depth)","legendFormat":"depth"}]},
|
||||
{"type":"timeseries","title":"Oldest job age (s)","gridPos":{"h":8,"w":8,"x":8,"y":26},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"s","custom":{"drawStyle":"line","fillOpacity":10},"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"yellow","value":60},{"color":"red","value":300}]}},"overrides":[]},
|
||||
"targets":[{"expr":"max(messenger_queue_oldest_job_age_seconds)","legendFormat":"oldest age"}]},
|
||||
{"type":"timeseries","title":"Time to ready p50/p95 (s)","gridPos":{"h":8,"w":8,"x":16,"y":26},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"s","custom":{"drawStyle":"line","fillOpacity":0}},"overrides":[]},
|
||||
"targets":[
|
||||
{"expr":"histogram_quantile(0.50, sum by (le) (rate(messenger_time_to_ready_seconds_bucket[5m])))","legendFormat":"p50"},
|
||||
{"expr":"histogram_quantile(0.95, sum by (le) (rate(messenger_time_to_ready_seconds_bucket[5m])))","legendFormat":"p95"}
|
||||
]},
|
||||
{"type":"row","title":"Saturation","gridPos":{"h":1,"w":24,"x":0,"y":34},"collapsed":false,"panels":[]},
|
||||
{"type":"timeseries","title":"Worker busy slots (capacity 2)","gridPos":{"h":8,"w":8,"x":0,"y":35},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"short","custom":{"drawStyle":"line","fillOpacity":10},"max":2},"overrides":[]},
|
||||
"targets":[{"expr":"sum(messenger_worker_busy)","legendFormat":"busy"}]},
|
||||
{"type":"timeseries","title":"DB pool (available / waiting)","gridPos":{"h":8,"w":8,"x":8,"y":35},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"short","custom":{"drawStyle":"line","fillOpacity":10}},"overrides":[]},
|
||||
"targets":[{"expr":"sum by (state) (messenger_db_pool)","legendFormat":"{{state}}"}]},
|
||||
{"type":"timeseries","title":"Active HTTP requests","gridPos":{"h":8,"w":8,"x":16,"y":35},"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},
|
||||
"fieldConfig":{"defaults":{"unit":"short","custom":{"drawStyle":"line","fillOpacity":10}},"overrides":[]},
|
||||
"targets":[{"expr":"sum(http_server_active_requests)","legendFormat":"active"}]}
|
||||
],
|
||||
"refresh": "10s",
|
||||
"schemaVersion": 39,
|
||||
"tags": ["messenger","lab6"],
|
||||
"templating": {"list": []},
|
||||
"time": {"from": "now-15m", "to": "now"},
|
||||
"timezone": "browser",
|
||||
"title": "Messenger — lab6",
|
||||
"uid": "messenger-lab6"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: messenger
|
||||
orgId: 1
|
||||
folder: Messenger
|
||||
type: file
|
||||
disableDeletion: false
|
||||
updateIntervalSeconds: 30
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards
|
||||
foldersFromFilesStructure: false
|
||||
@@ -0,0 +1,31 @@
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
jsonData:
|
||||
timeInterval: 10s
|
||||
- name: Loki
|
||||
type: loki
|
||||
access: proxy
|
||||
url: http://loki:3100
|
||||
jsonData:
|
||||
derivedFields:
|
||||
- datasourceUid: tempo
|
||||
matcherRegex: '"trace_id":"([a-f0-9]+)"'
|
||||
name: TraceID
|
||||
url: "$${__value.raw}"
|
||||
- name: Tempo
|
||||
type: tempo
|
||||
access: proxy
|
||||
url: http://tempo:3200
|
||||
uid: tempo
|
||||
jsonData:
|
||||
tracesToLogsV2:
|
||||
datasourceUid: loki
|
||||
filterByTraceID: true
|
||||
serviceMap:
|
||||
datasourceUid: prometheus
|
||||
Reference in New Issue
Block a user