1{ 2 "uid": "factory-workers-queues", 3 "title": "Factory — Workers / Queues", 4 "tags": ["factory", "observability", "worker", "queues"], 5 "timezone": "browser", 6 "schemaVersion": 39, 7 "version": 1, 8 "editable": true, 9 "refresh": "30s", 10 "time": { "from": "now-6h", "to": "now" }, 11 "panels": [ 12 { 13 "id": 1, 14 "type": "timeseries", 15 "title": "Queue depth per queue (waiting + delayed)", 16 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 17 "gridPos": { "h": 9, "w": 12, "x": 0, "y": 0 }, 18 "fieldConfig": { "defaults": { "unit": "short", "custom": { "drawStyle": "line", "fillOpacity": 15 }, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 10000 } ] } }, "overrides": [] }, 19 "options": { "legend": { "displayMode": "table", "placement": "right" }, "thresholds": { "mode": "absolute" } }, 20 "targets": [ { "refId": "A", "expr": "queue_depth{service_name=\"factory-worker\"}", "legendFormat": "{{queue}}" } ] 21 }, 22 { 23 "id": 2, 24 "type": "timeseries", 25 "title": "Job processing p95 by queue (10 m)", 26 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 27 "gridPos": { "h": 9, "w": 12, "x": 12, "y": 0 }, 28 "fieldConfig": { "defaults": { "unit": "s", "custom": { "drawStyle": "line" } }, "overrides": [] }, 29 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 30 "targets": [ { "refId": "A", "expr": "factory_worker:queue_job_duration_seconds:p95", "legendFormat": "{{queue}}" } ] 31 }, 32 { 33 "id": 3, 34 "type": "timeseries", 35 "title": "Jobs processed / s by queue (5 m)", 36 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 37 "gridPos": { "h": 8, "w": 8, "x": 0, "y": 9 }, 38 "fieldConfig": { "defaults": { "unit": "ops", "custom": { "drawStyle": "line" } }, "overrides": [] }, 39 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 40 "targets": [ { "refId": "A", "expr": "factory_worker:queue_jobs:rate5m", "legendFormat": "{{queue}}" } ] 41 }, 42 { 43 "id": 4, 44 "type": "timeseries", 45 "title": "Job duration (mean) by queue (5 m)", 46 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 47 "gridPos": { "h": 8, "w": 8, "x": 8, "y": 9 }, 48 "fieldConfig": { "defaults": { "unit": "s", "custom": { "drawStyle": "line" } }, "overrides": [] }, 49 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 50 "targets": [ { "refId": "A", "expr": "sum by (queue) (rate(queue_job_duration_seconds_sum{service_name=\"factory-worker\"}[5m])) / sum by (queue) (rate(queue_job_duration_seconds_count{service_name=\"factory-worker\"}[5m]))", "legendFormat": "{{queue}}" } ] 51 }, 52 { 53 "id": 5, 54 "type": "timeseries", 55 "title": "Search-index consumer lag (SLO 30 s)", 56 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 57 "gridPos": { "h": 8, "w": 8, "x": 16, "y": 9 }, 58 "fieldConfig": { "defaults": { "unit": "s", "custom": { "drawStyle": "line" }, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 30 } ] } }, "overrides": [] }, 59 "options": { "legend": { "displayMode": "list", "placement": "bottom" }, "thresholds": { "mode": "absolute" } }, 60 "targets": [ { "refId": "A", "expr": "search_index_lag_seconds{service_name=\"factory-worker\"}", "legendFormat": "lag" } ] 61 }, 62 { 63 "id": 6, 64 "type": "timeseries", 65 "title": "Worker errors by code (error_total, 5 m)", 66 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 67 "gridPos": { "h": 8, "w": 24, "x": 0, "y": 17 }, 68 "fieldConfig": { "defaults": { "unit": "ops", "custom": { "drawStyle": "bars" } }, "overrides": [] }, 69 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 70 "targets": [ { "refId": "A", "expr": "sum by (code) (rate(error_total{service_name=\"factory-worker\"}[5m]))", "legendFormat": "{{code}}" } ] 71 } 72 ], 73 "annotations": { 74 "list": [ 75 { 76 "builtIn": 1, 77 "datasource": { "type": "grafana", "uid": "-- Grafana --" }, 78 "name": "DLQ / retry panels — SPEC GAP", 79 "description": "The spec's Workers/Queues dashboard asks for a DLQ count + retry rate panel, but NEITHER metric is in the spec's 14-metric list (the BullMQ 5 worker records no DLQ/retry metric; failed jobs are visible in the error_total{code} panel above + the /health/search-index:lag probe). Recorded in infrastructure/observability/README.md (spec-conflict, AGENTS rule 29) rather than guessed at — a `queue_failed_jobs_total` metric is the follow-up if the gap matters.", 80 "enable": true, 81 "hide": false, 82 "iconColor": "rgba(255, 96, 96, 1)" 83 } 84 ] 85 } 86} 87