{ "id": null, "uid": "lab6-messenger", "title": "Messenger observability", "tags": [ "lab6" ], "timezone": "browser", "schemaVersion": 39, "version": 1, "refresh": "5s", "time": { "from": "now-15m", "to": "now" }, "panels": [ { "id": 1, "type": "timeseries", "title": "API requests per second", "description": "Per-second rate across both API replicas, excluding health checks. Window 1 minute.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 0 }, "fieldConfig": { "defaults": { "unit": "reqps", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "sum(rate(messenger_http_requests_total{route!~\"/health/(live|ready)\"}[1m]))", "legendFormat": "All business requests" }, { "refId": "B", "expr": "sum(rate(messenger_http_requests_total{route!~\"/health/(live|ready)\",status_class=\"5xx\"}[1m]))", "legendFormat": "5xx" } ] }, { "id": 2, "type": "timeseries", "title": "API error ratio", "description": "Server errors divided by all business responses. An empty window has no ratio.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 0 }, "fieldConfig": { "defaults": { "unit": "percentunit", "min": 0, "max": 1 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "(sum(rate(messenger_http_requests_total{route!~\"/health/(live|ready)\",status_class=\"5xx\"}[1m])) or 0 * sum(rate(messenger_http_requests_total{route!~\"/health/(live|ready)\"}[1m]))) / (sum(rate(messenger_http_requests_total{route!~\"/health/(live|ready)\"}[1m])) > 0)", "legendFormat": "5xx / requests" } ] }, { "id": 3, "type": "timeseries", "title": "API response duration", "description": "p50, p95 and p99 from cumulative histogram buckets, aggregated across replicas.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 7 }, "fieldConfig": { "defaults": { "unit": "s", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route!~\"/health/(live|ready)\"}[1m])))", "legendFormat": "p50" }, { "refId": "B", "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route!~\"/health/(live|ready)\"}[1m])))", "legendFormat": "p95" }, { "refId": "C", "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route!~\"/health/(live|ready)\"}[1m])))", "legendFormat": "p99" } ] }, { "id": 4, "type": "timeseries", "title": "Worker job outcomes per second", "description": "Rate of actual attempts, grouped by outcome. Duplicate deliveries without a claim are not attempts.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 7 }, "fieldConfig": { "defaults": { "unit": "ops", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "sum by (outcome) (rate(messenger_jobs_total[1m]))", "legendFormat": "{{outcome}}" } ] }, { "id": 5, "type": "timeseries", "title": "Worker processing duration", "description": "p50, p95 and p99 from the duration histogram for claimed attempts.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 14 }, "fieldConfig": { "defaults": { "unit": "s", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_job_duration_seconds_bucket[1m])))", "legendFormat": "p50" }, { "refId": "B", "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_duration_seconds_bucket[1m])))", "legendFormat": "p95" }, { "refId": "C", "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_duration_seconds_bucket[1m])))", "legendFormat": "p99" } ] }, { "id": 6, "type": "timeseries", "title": "Attachment time to ready", "description": "From durable job creation to the commit that exposes ready. Includes time queued and any retries.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 14 }, "fieldConfig": { "defaults": { "unit": "s", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[1m])))", "legendFormat": "p50" }, { "refId": "B", "expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[1m])))", "legendFormat": "p95" }, { "refId": "C", "expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[1m])))", "legendFormat": "p99" } ] }, { "id": 7, "type": "timeseries", "title": "Queue depth", "description": "Durable queued jobs on the current pipeline version, including pending outbox and delayed retries.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 21 }, "fieldConfig": { "defaults": { "unit": "short", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "max by (queue) (messenger_queue_depth)", "legendFormat": "{{queue}}" } ] }, { "id": 8, "type": "timeseries", "title": "Oldest queued job age", "description": "Elapsed time since the oldest job still in the durable queue was accepted.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 21 }, "fieldConfig": { "defaults": { "unit": "s", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "max by (queue) (messenger_queue_oldest_age_seconds)", "legendFormat": "{{queue}}" } ] }, { "id": 9, "type": "timeseries", "title": "PostgreSQL pool used and capacity", "description": "Checked-out connections and configured pool capacity, summed per service.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 28 }, "fieldConfig": { "defaults": { "unit": "short", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "sum by (service_name,state) (messenger_db_pool_connections)", "legendFormat": "{{service_name}} / {{state}}" } ] }, { "id": 10, "type": "timeseries", "title": "PostgreSQL pool waiting", "description": "Acquisition calls in progress. Instantaneous gauge, so very short waits can fall between scrapes.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 28 }, "fieldConfig": { "defaults": { "unit": "short", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "sum by (service_name) (messenger_db_pool_waiting)", "legendFormat": "{{service_name}}" } ] }, { "id": 11, "type": "timeseries", "title": "Worker busy and capacity", "description": "Active claimed jobs and total processing lanes.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 35 }, "fieldConfig": { "defaults": { "unit": "short", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "sum(messenger_worker_busy)", "legendFormat": "Busy" }, { "refId": "B", "expr": "sum(messenger_worker_capacity)", "legendFormat": "Capacity" } ] }, { "id": 12, "type": "timeseries", "title": "Worker saturation", "description": "Fraction of processing lanes occupied by claimed attempts.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 35 }, "fieldConfig": { "defaults": { "unit": "percentunit", "min": 0, "max": 1 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "sum(messenger_worker_busy) / (sum(messenger_worker_capacity) > 0)", "legendFormat": "Busy / capacity" } ] }, { "id": 13, "type": "timeseries", "title": "Process CPU", "description": "CPU seconds per wall second. 1.0 is one full CPU core.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 42 }, "fieldConfig": { "defaults": { "unit": "none", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "rate(messenger_process_cpu_time_seconds_total[1m])", "legendFormat": "{{service_name}} / {{service_instance_id}}" } ] }, { "id": 14, "type": "timeseries", "title": "Process resident memory", "description": "RSS per application process, read from Linux statm.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 42 }, "fieldConfig": { "defaults": { "unit": "bytes", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "messenger_process_memory_bytes", "legendFormat": "{{service_name}} / {{service_instance_id}}" } ] }, { "id": 15, "type": "timeseries", "title": "Firing alerts", "description": "Firing state reported by Prometheus. Inactive rules disappear from this series.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 49 }, "fieldConfig": { "defaults": { "unit": "short", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "ALERTS{alertname=~\"HighAPIErrorRate|GrowingQueueLag\",alertstate=\"firing\"}", "legendFormat": "{{alertname}} {{queue}}" } ] }, { "id": 16, "type": "timeseries", "title": "Collector exporter queue", "description": "Batches pending delivery to telemetry storage and the configured queue limit.", "datasource": { "type": "prometheus", "uid": "lab-prometheus" }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 49 }, "fieldConfig": { "defaults": { "unit": "short", "min": 0 }, "overrides": [] }, "targets": [ { "refId": "A", "expr": "otelcol_exporter_queue_size", "legendFormat": "{{exporter}} queued" }, { "refId": "B", "expr": "otelcol_exporter_queue_capacity", "legendFormat": "{{exporter}} capacity" } ] }, { "id": 17, "type": "logs", "title": "Correlated API and worker logs", "description": "Expand a log line and follow its TraceID to Tempo.", "datasource": { "type": "loki", "uid": "lab-loki" }, "gridPos": { "h": 9, "w": 24, "x": 0, "y": 56 }, "targets": [ { "refId": "A", "expr": "{service_name=~\"messenger-api|messenger-worker\"}" } ], "options": { "showTime": true, "sortOrder": "Descending", "wrapLogMessage": false } } ] }