1{ 2 "uid": "factory-api-overview", 3 "title": "Factory — API Overview", 4 "tags": ["factory", "observability", "api"], 5 "timezone": "browser", 6 "schemaVersion": 39, 7 "version": 1, 8 "editable": true, 9 "refresh": "30s", 10 "time": { "from": "now-3h", "to": "now" }, 11 "panels": [ 12 { 13 "id": 1, 14 "type": "stat", 15 "title": "Requests / s (5 m)", 16 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 17 "gridPos": { "h": 4, "w": 4, "x": 0, "y": 0 }, 18 "fieldConfig": { "defaults": { "unit": "reqps", "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null } ] } }, "overrides": [] }, 19 "options": { "colorMode": "value", "graphMode": "area" }, 20 "targets": [ { "refId": "A", "expr": "sum(rate(http_request_count_total{service_name=\"factory-api\"}[5m]))", "legendFormat": "rps" } ] 21 }, 22 { 23 "id": 2, 24 "type": "stat", 25 "title": "p95 (overall, 5 m)", 26 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 27 "gridPos": { "h": 4, "w": 4, "x": 4, "y": 0 }, 28 "fieldConfig": { "defaults": { "unit": "s", "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 0.5 } ] } }, "overrides": [] }, 29 "options": { "colorMode": "value", "graphMode": "area" }, 30 "targets": [ { "refId": "A", "expr": "max(factory_api:http_request_duration_seconds:p95{quantile=\"0.95\"})", "legendFormat": "p95" } ] 31 }, 32 { 33 "id": 3, 34 "type": "stat", 35 "title": "Error rate 5xx (5 m)", 36 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 37 "gridPos": { "h": 4, "w": 4, "x": 8, "y": 0 }, 38 "fieldConfig": { "defaults": { "unit": "percentunit", "decimals": 2, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 0.01 } ] } }, "overrides": [] }, 39 "options": { "colorMode": "value", "graphMode": "area" }, 40 "targets": [ { "refId": "A", "expr": "factory_api:http_request_error_rate:5m", "legendFormat": "5xx ratio" } ] 41 }, 42 { 43 "id": 4, 44 "type": "timeseries", 45 "title": "Requests / s by route group", 46 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 47 "gridPos": { "h": 8, "w": 12, "x": 0, "y": 4 }, 48 "fieldConfig": { "defaults": { "unit": "reqps", "custom": { "drawStyle": "line", "fillOpacity": 10 } }, "overrides": [] }, 49 "options": { "legend": { "displayMode": "table", "placement": "right" } }, 50 "targets": [ { "refId": "A", "expr": "sum by (route_group) (rate(http_request_count_total{service_name=\"factory-api\"}[5m]))", "legendFormat": "{{route_group}}" } ] 51 }, 52 { 53 "id": 5, 54 "type": "timeseries", 55 "title": "Latency quantiles by route group (p50 / p95 / p99)", 56 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 57 "gridPos": { "h": 8, "w": 12, "x": 12, "y": 4 }, 58 "fieldConfig": { "defaults": { "unit": "s", "custom": { "drawStyle": "line", "fillOpacity": 5 } }, "overrides": [] }, 59 "options": { "legend": { "displayMode": "table", "placement": "right" } }, 60 "targets": [ 61 { "refId": "A", "expr": "factory_api:http_request_duration_seconds:p50", "legendFormat": "{{route_group}} p50" }, 62 { "refId": "B", "expr": "factory_api:http_request_duration_seconds:p95", "legendFormat": "{{route_group}} p95" }, 63 { "refId": "C", "expr": "factory_api:http_request_duration_seconds:p99", "legendFormat": "{{route_group}} p99" } 64 ] 65 }, 66 { 67 "id": 6, 68 "type": "timeseries", 69 "title": "Requests by status", 70 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 71 "gridPos": { "h": 8, "w": 8, "x": 0, "y": 12 }, 72 "fieldConfig": { "defaults": { "unit": "reqps", "custom": { "drawStyle": "line" } }, "overrides": [] }, 73 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 74 "targets": [ { "refId": "A", "expr": "sum by (status) (rate(http_request_count_total{service_name=\"factory-api\"}[5m]))", "legendFormat": "HTTP {{status}}" } ] 75 }, 76 { 77 "id": 7, 78 "type": "timeseries", 79 "title": "5xx by route group", 80 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 81 "gridPos": { "h": 8, "w": 8, "x": 8, "y": 12 }, 82 "fieldConfig": { "defaults": { "unit": "reqps", "custom": { "drawStyle": "line" } }, "overrides": [] }, 83 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 84 "targets": [ { "refId": "A", "expr": "sum by (route_group) (rate(http_request_count_total{service_name=\"factory-api\", status=~\"5..\"}[5m]))", "legendFormat": "{{route_group}}" } ] 85 }, 86 { 87 "id": 8, 88 "type": "timeseries", 89 "title": "Handled errors by code (error_total, 5 m)", 90 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 91 "gridPos": { "h": 8, "w": 8, "x": 16, "y": 12 }, 92 "fieldConfig": { "defaults": { "unit": "ops", "custom": { "drawStyle": "bars" } }, "overrides": [] }, 93 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 94 "targets": [ { "refId": "A", "expr": "sum by (code) (rate(error_total{service_name=\"factory-api\"}[5m]))", "legendFormat": "{{code}}" } ] 95 }, 96 { 97 "id": 9, 98 "type": "timeseries", 99 "title": "DB query p95 by model (10 m)", 100 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 101 "gridPos": { "h": 8, "w": 12, "x": 0, "y": 20 }, 102 "fieldConfig": { "defaults": { "unit": "s", "custom": { "drawStyle": "line" } }, "overrides": [] }, 103 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 104 "targets": [ { "refId": "A", "expr": "factory_api:db_query_duration_seconds:p95", "legendFormat": "{{model}}" } ] 105 }, 106 { 107 "id": 10, 108 "type": "timeseries", 109 "title": "Redis command p95 (10 m)", 110 "datasource": { "type": "prometheus", "uid": "factory-prometheus" }, 111 "gridPos": { "h": 8, "w": 12, "x": 12, "y": 20 }, 112 "fieldConfig": { "defaults": { "unit": "s", "custom": { "drawStyle": "line" } }, "overrides": [] }, 113 "options": { "legend": { "displayMode": "list", "placement": "bottom" } }, 114 "targets": [ { "refId": "A", "expr": "histogram_quantile(0.95, sum by (le, command) (rate(redis_command_duration_seconds_bucket{service_name=~\"factory-(api|worker)\"}[10m])))", "legendFormat": "{{command}}" } ] 115 } 116 ] 117} 118