Перенеси реализацию мессенджера из ЛР 6
Источник — проверенное рабочее дерево ЛР 6 поверх 18878d6, включая изменения после повторного ревью. SHA-256 списка исходных файлов: e45a3d85b41feff1da78dce3f20fd1f4af1c5ee629e6ed703218bc8e21ad58fe.
This commit is contained in:
@@ -0,0 +1,500 @@
|
||||
{
|
||||
"uid": "messenger",
|
||||
"title": "Messenger reliability",
|
||||
"schemaVersion": 41,
|
||||
"version": 1,
|
||||
"refresh": "5s",
|
||||
"time": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 1,
|
||||
"title": "Business request rate",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "{{method}} {{route}}",
|
||||
"expr": "sum by (method, route) (rate(messenger_http_requests_total[30s]))"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 2,
|
||||
"title": "Business HTTP 5xx",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "5xx ratio",
|
||||
"expr": "lab:http_bad_ratio:30s"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 3,
|
||||
"title": "HTTP latency across replicas",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "p50",
|
||||
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_http_duration_seconds_bucket[30s])))"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"legendFormat": "p95",
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_http_duration_seconds_bucket[30s])))"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"legendFormat": "p99",
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_http_duration_seconds_bucket[30s])))"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 4,
|
||||
"title": "Job outcomes",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "{{outcome}}",
|
||||
"expr": "sum by (outcome) (rate(messenger_jobs_total[30s]))"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 5,
|
||||
"title": "Job processing duration",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "p95 {{outcome}}",
|
||||
"expr": "histogram_quantile(0.95,sum by (le,outcome) (rate(messenger_job_duration_seconds_bucket[2m])))"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 6,
|
||||
"title": "Acceptance to first ready",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "p95",
|
||||
"expr": "histogram_quantile(0.95,sum by (le) (rate(messenger_ready_duration_seconds_bucket[2m])))"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 7,
|
||||
"title": "Queued jobs",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "queued",
|
||||
"expr": "max(messenger_queue_depth and on(job, instance) lab:queue_snapshot:latest)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 8,
|
||||
"title": "Oldest queued job",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "age",
|
||||
"expr": "max(messenger_queue_oldest_seconds and on(job, instance) lab:queue_snapshot:latest)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 9,
|
||||
"title": "DB pool connections",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "acquired {{job}} {{instance}}",
|
||||
"expr": "messenger_db_pool_acquired"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"legendFormat": "maximum {{job}} {{instance}}",
|
||||
"expr": "messenger_db_pool_max"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 10,
|
||||
"title": "DB pool waiting time per second",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "{{job}} {{instance}}",
|
||||
"expr": "rate(messenger_db_pool_wait_seconds_total[30s])"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 11,
|
||||
"title": "Worker concurrency",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "active {{instance}}",
|
||||
"expr": "messenger_worker_active"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"legendFormat": "capacity {{instance}}",
|
||||
"expr": "messenger_worker_capacity"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 12,
|
||||
"title": "Process CPU cores",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "{{job}} {{instance}}",
|
||||
"expr": "rate(messenger_process_cpu_seconds_total[30s])"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 13,
|
||||
"title": "Resident memory",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "{{job}} {{instance}}",
|
||||
"expr": "messenger_process_resident_bytes"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 14,
|
||||
"title": "SLI error ratios",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "http 30s",
|
||||
"expr": "lab:http_bad_ratio:30s"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"legendFormat": "http 2m",
|
||||
"expr": "lab:http_bad_ratio:2m"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"legendFormat": "ready 30s",
|
||||
"expr": "lab:ready_bad_ratio:30s"
|
||||
},
|
||||
{
|
||||
"refId": "D",
|
||||
"legendFormat": "ready 2m",
|
||||
"expr": "lab:ready_bad_ratio:2m"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 15,
|
||||
"title": "Eligible observations",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "http 30s",
|
||||
"expr": "lab:http_count:30s"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"legendFormat": "http 2m",
|
||||
"expr": "lab:http_count:2m"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"legendFormat": "ready 30s",
|
||||
"expr": "lab:ready_count:30s"
|
||||
},
|
||||
{
|
||||
"refId": "D",
|
||||
"legendFormat": "ready 2m",
|
||||
"expr": "lab:ready_count:2m"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 16,
|
||||
"title": "Exporter queue occupancy",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prom"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"legendFormat": "queued {{exporter}}",
|
||||
"expr": "otelcol_exporter_queue_size"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"legendFormat": "capacity {{exporter}}",
|
||||
"expr": "otelcol_exporter_queue_capacity"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: Messenger
|
||||
type: file
|
||||
options:
|
||||
path: /etc/grafana/dashboards
|
||||
@@ -0,0 +1,33 @@
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
uid: prom
|
||||
type: prometheus
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
jsonData:
|
||||
timeInterval: 2s
|
||||
- name: Loki
|
||||
uid: loki
|
||||
type: loki
|
||||
url: http://loki:3100
|
||||
jsonData:
|
||||
derivedFields:
|
||||
- name: TraceID
|
||||
matcherType: label
|
||||
matcherRegex: "^trace_id$"
|
||||
datasourceUid: tempo
|
||||
url: '$${__value.raw}'
|
||||
- name: Tempo
|
||||
uid: tempo
|
||||
type: tempo
|
||||
url: http://tempo:3200
|
||||
jsonData:
|
||||
tracesToLogsV2:
|
||||
datasourceUid: loki
|
||||
tags:
|
||||
- key: service.name
|
||||
value: service_name
|
||||
filterByTraceID: true
|
||||
customQuery: true
|
||||
query: '{$${__tags}} | trace_id="$${__trace.traceId}"'
|
||||
Reference in New Issue
Block a user