{ "uid": "messenger-lab6", "title": "Messenger lab 6: API, worker, queue, SLO", "description": "Generated by scripts/build_dashboard.py - edit the script, not the JSON.", "tags": [ "messenger", "lab6" ], "timezone": "browser", "schemaVersion": 39, "version": 1, "editable": false, "graphTooltip": 1, "refresh": "10s", "time": { "from": "now-30m", "to": "now" }, "templating": { "list": [] }, "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "grafana", "uid": "-- Grafana --" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "panels": [ { "type": "row", "title": "API: requests, errors, latency (all replicas)", "id": 2, "collapsed": false, "panels": [], "gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 } }, { "type": "timeseries", "title": "Requests per second by route", "id": 3, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Business requests (no /health/*) per second, summed over the API replicas. Counter = _count of the histogram http.server.request.duration (no second instrument).\n\nUnit: reqps.", "gridPos": { "h": 8, "w": 8, "x": 0, "y": 1 }, "fieldConfig": { "defaults": { "unit": "reqps", "custom": { "lineWidth": 1, "fillOpacity": 40, "showPoints": "never", "stacking": { "mode": "normal", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (http_route) (rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval]))", "legendFormat": "{{http_route}}", "range": true } ] }, { "type": "timeseries", "title": "Error ratio (5xx and 4xx / all business requests)", "id": 4, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Numerator: 5xx (or 4xx) business requests; denominator: all business requests. Alert MessengerApiHighErrorRate: 5xx > 5 % for 1 min.\n\nUnit: percentunit.", "gridPos": { "h": 8, "w": 8, "x": 8, "y": 1 }, "fieldConfig": { "defaults": { "unit": "percentunit", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" }, "thresholdsStyle": { "mode": "line+area" } }, "min": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 0.05 } ] } }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "(sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_response_status_class=\"5xx\"}[$__rate_interval])) or vector(0)) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval]))", "legendFormat": "5xx (SLI: server failures)", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "(sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_response_status_class=\"4xx\"}[$__rate_interval])) or vector(0)) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval]))", "legendFormat": "4xx (client errors, not in the SLI)", "range": true } ] }, { "type": "timeseries", "title": "Latency p50 / p95 / p99 (all routes, all replicas)", "id": 5, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "histogram_quantile over the buckets of http.server.request.duration summed by le across replicas (buckets 1 ms ... 10 s). Not an average, not per-replica p99s averaged.\n\nUnit: s.", "gridPos": { "h": 8, "w": 8, "x": 16, "y": 1 }, "fieldConfig": { "defaults": { "unit": "s", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval])))", "legendFormat": "p50", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval])))", "legendFormat": "p95", "range": true }, { "refId": "C", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval])))", "legendFormat": "p99", "range": true } ] }, { "type": "timeseries", "title": "p95 by route", "id": 6, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Per route template, buckets of all replicas.\n\nUnit: s.", "gridPos": { "h": 8, "w": 12, "x": 0, "y": 9 }, "fieldConfig": { "defaults": { "unit": "s", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le, http_route) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval])))", "legendFormat": "{{http_route}}", "range": true } ] }, { "type": "timeseries", "title": "Requests in flight by replica", "id": 7, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "UpDownCounter http.server.active_requests per API replica (saturation of the HTTP layer).\n\nUnit: short.", "gridPos": { "h": 8, "w": 12, "x": 12, "y": 9 }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (instance) (http_server_active_requests{job=\"messenger-api\"})", "legendFormat": "{{instance}}", "range": true } ] }, { "type": "row", "title": "Worker and queue", "id": 8, "collapsed": false, "panels": [], "gridPos": { "h": 1, "w": 24, "x": 0, "y": 17 } }, { "type": "timeseries", "title": "Jobs handled per second by outcome", "id": 9, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "messenger.jobs.processed: succeeded / retry / failed / fenced / superseded / noop_* / deferred / rejected.\n\nUnit: ops.", "gridPos": { "h": 8, "w": 8, "x": 0, "y": 18 }, "fieldConfig": { "defaults": { "unit": "ops", "custom": { "lineWidth": 1, "fillOpacity": 40, "showPoints": "never", "stacking": { "mode": "normal", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (outcome) (rate(messenger_jobs_processed_total[$__rate_interval]))", "legendFormat": "{{outcome}}", "range": true } ] }, { "type": "timeseries", "title": "Job duration p50 / p95 / p99 (succeeded)", "id": 10, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "One delivery in the worker: claim -> S3 read -> variants -> S3 writes -> COMMIT -> ack.\n\nUnit: s.", "gridPos": { "h": 8, "w": 8, "x": 8, "y": 18 }, "fieldConfig": { "defaults": { "unit": "s", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"succeeded\"}[$__rate_interval])))", "legendFormat": "p50", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"succeeded\"}[$__rate_interval])))", "legendFormat": "p95", "range": true }, { "refId": "C", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket{outcome=\"succeeded\"}[$__rate_interval])))", "legendFormat": "p99", "range": true } ] }, { "type": "timeseries", "title": "Time to ready p50 / p95 / p99 (uploads)", "id": 11, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "From the durable acceptance (job COMMIT before 202) to the COMMIT of status ready. Includes queue wait and retries. SLO: 99 % within 30 s.\n\nUnit: s.", "gridPos": { "h": 8, "w": 8, "x": 16, "y": 18 }, "fieldConfig": { "defaults": { "unit": "s", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{}[$__rate_interval])))", "legendFormat": "p50", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{}[$__rate_interval])))", "legendFormat": "p95", "range": true }, { "refId": "C", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket{}[$__rate_interval])))", "legendFormat": "p99", "range": true } ] }, { "type": "timeseries", "title": "Queue depth (PostgreSQL) and outbox", "id": 12, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "messenger.queue.depth: unfinished jobs (queued incl. retry wait / processing); messenger.outbox.pending: unpublished messages (due / delayed). Reported by the relay every 5 s.\n\nUnit: short.", "gridPos": { "h": 8, "w": 8, "x": 0, "y": 26 }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (state) (messenger_queue_depth)", "legendFormat": "jobs {{state}}", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (state) (messenger_outbox_pending)", "legendFormat": "outbox {{state}}", "range": true } ] }, { "type": "timeseries", "title": "Oldest job age / oldest due outbox row", "id": 13, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Age of the oldest unfinished job (now - acceptance). Grows when nobody processes the queue. Alert MessengerQueueLagGrowing: > 60 s for 1 min with queued jobs.\n\nUnit: s.", "gridPos": { "h": 8, "w": 8, "x": 8, "y": 26 }, "fieldConfig": { "defaults": { "unit": "s", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" }, "thresholdsStyle": { "mode": "line+area" } }, "min": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 60 } ] } }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max(messenger_queue_oldest_age_seconds)", "legendFormat": "oldest unfinished job", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max(messenger_outbox_oldest_age_seconds)", "legendFormat": "oldest due outbox row (broker)", "range": true } ] }, { "type": "timeseries", "title": "Worker saturation (busy / capacity)", "id": 14, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "messenger.worker.busy (attempts running) / messenger.worker.capacity (WORKER_CONCURRENCY), all worker processes. 100 % for long = the worker is the bottleneck.\n\nUnit: percentunit.", "gridPos": { "h": 8, "w": 8, "x": 16, "y": 26 }, "fieldConfig": { "defaults": { "unit": "percentunit", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0, "max": 1 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(messenger_worker_busy) / sum(messenger_worker_capacity)", "legendFormat": "busy share", "range": true } ] }, { "type": "row", "title": "Database pool and resources", "id": 15, "collapsed": false, "panels": [], "gridPos": { "h": 1, "w": 24, "x": 0, "y": 34 } }, { "type": "timeseries", "title": "DB pool: used / max, waiting requests", "id": 16, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "psycopg_pool counters per service (all replicas summed). Waiting > 0 = pool exhausted.\n\nUnit: short.", "gridPos": { "h": 8, "w": 8, "x": 0, "y": 35 }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job) (db_client_connection_count{db_client_connection_state=\"used\"})", "legendFormat": "{{job}} used", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job) (db_client_connection_max)", "legendFormat": "{{job}} max", "range": true }, { "refId": "C", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job) (db_client_connection_pending_requests)", "legendFormat": "{{job}} waiting", "range": true } ] }, { "type": "timeseries", "title": "DB unit of work p95 by service", "id": 17, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "db.client.operation.duration: pool wait + statements + COMMIT of one Database.run().\n\nUnit: s.", "gridPos": { "h": 8, "w": 8, "x": 8, "y": 35 }, "fieldConfig": { "defaults": { "unit": "s", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le, job) (rate(db_client_operation_duration_seconds_bucket{}[$__rate_interval])))", "legendFormat": "{{job}}", "range": true } ] }, { "type": "timeseries", "title": "DB pool wait p95 by service", "id": 18, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "db.client.connection.wait_time: time to get a connection from the pool.\n\nUnit: s.", "gridPos": { "h": 8, "w": 8, "x": 16, "y": 35 }, "fieldConfig": { "defaults": { "unit": "s", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "histogram_quantile(0.95, sum by (le, job) (rate(db_client_connection_wait_time_seconds_bucket{}[$__rate_interval])))", "legendFormat": "{{job}}", "range": true } ] }, { "type": "timeseries", "title": "Container CPU (cores)", "id": 19, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "cgroup cpu.stat of each application container (1 = one full core); Collector: its own counter.\n\nUnit: short.", "gridPos": { "h": 8, "w": 12, "x": 0, "y": 43 }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job, instance) (rate(container_cpu_time_seconds_total[$__rate_interval]))", "legendFormat": "{{job}} {{instance}}", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "rate(otelcol_process_cpu_seconds[$__rate_interval])", "legendFormat": "otel-collector", "range": true } ] }, { "type": "timeseries", "title": "Container memory", "id": 20, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "cgroup memory.current of each application container; Collector RSS (memory_limiter: 400 MiB).\n\nUnit: bytes.", "gridPos": { "h": 8, "w": 12, "x": 12, "y": 43 }, "fieldConfig": { "defaults": { "unit": "bytes", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job, instance) (container_memory_usage_bytes)", "legendFormat": "{{job}} {{instance}}", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "otelcol_process_memory_rss", "legendFormat": "otel-collector RSS", "range": true } ] }, { "type": "row", "title": "SLO (docs/SLO.md) and alerts", "id": 21, "collapsed": false, "panels": [], "gridPos": { "h": 1, "w": 24, "x": 0, "y": 51 } }, { "type": "stat", "title": "Availability, last 1 h (target 99 %)", "id": 22, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "1 - 5xx/all business requests over 1 h.\n\nUnit: percentunit.", "gridPos": { "h": 5, "w": 6, "x": 0, "y": 52 }, "fieldConfig": { "defaults": { "unit": "percentunit", "decimals": 3, "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "orange", "value": 0.99 }, { "color": "green", "value": 0.995 } ] } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "area", "textMode": "value" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "1 - messenger:http_error_ratio:rate1h", "instant": false, "range": true } ] }, { "type": "stat", "title": "Requests under 250 ms, last 5 min (target 95 %)", "id": 23, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Share of business requests in buckets le=0.25.\n\nUnit: percentunit.", "gridPos": { "h": 5, "w": 6, "x": 6, "y": 52 }, "fieldConfig": { "defaults": { "unit": "percentunit", "decimals": 3, "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "green", "value": 0.95 } ] } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "area", "textMode": "value" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:http_fast_ratio:rate5m", "instant": false, "range": true } ] }, { "type": "stat", "title": "Uploads ready within 30 s, last 1 h (target 99 %)", "id": 24, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Share of uploads with time_to_ready <= 30 s.\n\nUnit: percentunit.", "gridPos": { "h": 5, "w": 6, "x": 12, "y": 52 }, "fieldConfig": { "defaults": { "unit": "percentunit", "decimals": 3, "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "green", "value": 0.99 } ] } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "area", "textMode": "value" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "messenger:ready_within_30s_ratio:rate1h", "instant": false, "range": true } ] }, { "type": "stat", "title": "Alerts firing", "id": 25, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Number of firing Prometheus alerts (table below).\n\nUnit: none.", "gridPos": { "h": 5, "w": 6, "x": 18, "y": 52 }, "fieldConfig": { "defaults": { "unit": "none", "decimals": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 1 } ] } }, "overrides": [] }, "options": { "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "colorMode": "background", "graphMode": "area", "textMode": "value" }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "count(ALERTS{alertstate=\"firing\"}) or vector(0)", "instant": false, "range": true } ] }, { "type": "table", "title": "Alerts (pending / firing)", "id": 26, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "ALERTS series of Prometheus (rules: infra/prometheus/rules/alerts.yml, runbook: docs/RUNBOOK.md).", "gridPos": { "h": 6, "w": 24, "x": 0, "y": 57 }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "ALERTS", "instant": true, "format": "table" } ], "transformations": [ { "id": "organize", "options": { "excludeByName": { "Time": true, "Value": true, "__name__": true }, "indexByName": {}, "renameByName": {} } } ], "fieldConfig": { "defaults": {}, "overrides": [] }, "options": { "showHeader": true } }, { "type": "row", "title": "Telemetry pipeline (Collector, SDK)", "id": 27, "collapsed": false, "panels": [], "gridPos": { "h": 1, "w": 24, "x": 0, "y": 63 } }, { "type": "timeseries", "title": "Collector: spans accepted / sent / failed per second", "id": 28, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "otelcol_* self-metrics, scraped from :8888. sent < accepted with tail sampling (dropped by policy).\n\nUnit: ops.", "gridPos": { "h": 8, "w": 8, "x": 0, "y": 64 }, "fieldConfig": { "defaults": { "unit": "ops", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_receiver_accepted_spans[$__rate_interval]))", "legendFormat": "accepted", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_receiver_refused_spans[$__rate_interval]))", "legendFormat": "refused (memory_limiter)", "range": true }, { "refId": "C", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_exporter_sent_spans[$__rate_interval]))", "legendFormat": "sent to Tempo", "range": true }, { "refId": "D", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_exporter_send_failed_spans[$__rate_interval]))", "legendFormat": "send failed (dropped)", "range": true } ] }, { "type": "timeseries", "title": "Collector: logs and metric points per second", "id": 29, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Same for the logs and metrics pipelines.\n\nUnit: ops.", "gridPos": { "h": 8, "w": 8, "x": 8, "y": 64 }, "fieldConfig": { "defaults": { "unit": "ops", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_receiver_accepted_log_records[$__rate_interval]))", "legendFormat": "logs accepted", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_exporter_send_failed_log_records[$__rate_interval]))", "legendFormat": "logs failed", "range": true }, { "refId": "C", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_receiver_accepted_metric_points[$__rate_interval]))", "legendFormat": "metric points accepted", "range": true }, { "refId": "D", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum(rate(otelcol_exporter_send_failed_metric_points[$__rate_interval]))", "legendFormat": "metric points failed", "range": true } ] }, { "type": "timeseries", "title": "Collector: exporter queues", "id": 30, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Bounded sending_queue (batches) per exporter: fills while a backend is down, never above capacity.\n\nUnit: short.", "gridPos": { "h": 8, "w": 8, "x": 16, "y": 64 }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (exporter) (otelcol_exporter_queue_size)", "legendFormat": "{{exporter}} size", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "max by (exporter) (otelcol_exporter_queue_capacity)", "legendFormat": "{{exporter}} capacity", "range": true } ] }, { "type": "timeseries", "title": "SDK: spans recorded vs exported (all processes)", "id": 31, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "Spans finished in the process (sampled) and handed to the OTLP exporter: success / failure (Collector down).\n\nUnit: ops.", "gridPos": { "h": 8, "w": 12, "x": 0, "y": 72 }, "fieldConfig": { "defaults": { "unit": "ops", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job) (rate(messenger_telemetry_spans_ended_total[$__rate_interval]))", "legendFormat": "{{job}} recorded", "range": true }, { "refId": "B", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "sum by (job, result) (rate(messenger_telemetry_spans_exported_total[$__rate_interval]))", "legendFormat": "{{job}} export {{result}}", "range": true } ] }, { "type": "timeseries", "title": "Telemetry components up", "id": 32, "datasource": { "type": "prometheus", "uid": "prometheus" }, "description": "1 = the scrape succeeded.\n\nUnit: short.", "gridPos": { "h": 8, "w": 12, "x": 12, "y": 72 }, "fieldConfig": { "defaults": { "unit": "short", "custom": { "lineWidth": 1, "fillOpacity": 10, "showPoints": "never", "stacking": { "mode": "none", "group": "A" } }, "min": 0, "max": 1 }, "overrides": [] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "desc" } }, "targets": [ { "refId": "A", "datasource": { "type": "prometheus", "uid": "prometheus" }, "expr": "up{job=~\"otel-collector|prometheus|loki|tempo|grafana\"}", "legendFormat": "{{job}}", "range": true } ] }, { "type": "row", "title": "Logs and traces", "id": 33, "collapsed": false, "panels": [], "gridPos": { "h": 1, "w": 24, "x": 0, "y": 80 } }, { "type": "logs", "title": "Application logs (Loki): warnings and errors", "id": 34, "datasource": { "type": "loki", "uid": "loki" }, "description": "OTLP log records of api/relay/worker. Expand a line: trace_id links to Tempo. Query: {service_name=~\"messenger-.+\"} | detected_level=~\"warn|error\".", "gridPos": { "h": 10, "w": 12, "x": 0, "y": 81 }, "targets": [ { "refId": "A", "datasource": { "type": "loki", "uid": "loki" }, "expr": "{service_name=~\"messenger-.+\"} | detected_level=~\"warn|error\"", "queryType": "range" } ], "options": { "showTime": true, "wrapLogMessage": true, "enableLogDetails": true, "sortOrder": "Descending", "dedupStrategy": "none", "prettifyLogMessage": false } }, { "type": "table", "title": "Recent upload traces (Tempo)", "id": 35, "datasource": { "type": "tempo", "uid": "tempo" }, "description": "TraceQL: POST of an attachment. Click a trace id: upload -> enqueue -> publish -> process -> S3/DB.", "gridPos": { "h": 10, "w": 12, "x": 12, "y": 81 }, "targets": [ { "refId": "A", "datasource": { "type": "tempo", "uid": "tempo" }, "queryType": "traceql", "limit": 20, "tableType": "traces", "query": "{ span.http.route = \"/api/v1/chats/{chat_id}/attachments\" }" } ], "fieldConfig": { "defaults": {}, "overrides": [] }, "options": { "showHeader": true } } ] }