839c64c12a
- Backend: OTel metrics via OTLP -> Alloy -> Prometheus (OTEL_METRICS_EXPORTER=otlp) - New business metrics (src/metrics.js): searches, CIMA latency/errors, cache hits/misses, logins, rate-limits, pharmacy writes/links, push sent/failed, DB + Redis timings/errors, HTTP req count/duration, heartbeat - Backend health endpoints /healthz and /readyz - Mobile (Expo): Grafana Faro RUM via @grafana/faro-react-native - redis/postgres exporters in docker-compose + Prometheus scrape jobs - Grafana dashboards (backend, datastores, mobile RUM, overview) - Prometheus alert rules (farmafinder_*) -> existing Alertmanager (Telegram) - Design/spec saved to docs/superpowers/specs/
146 lines
7.0 KiB
JSON
146 lines
7.0 KiB
JSON
{
|
|
"annotations": { "list": [] },
|
|
"editable": true,
|
|
"fiscalYearStartMonth": 0,
|
|
"graphTooltip": 1,
|
|
"id": null,
|
|
"links": [],
|
|
"liveNow": false,
|
|
"panels": [
|
|
{
|
|
"id": 1, "title": "Request rate (req/s)", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 8, "x": 0, "y": 0 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum(rate(http_requests_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "req/s" }
|
|
]
|
|
},
|
|
{
|
|
"id": 2, "title": "Requests by status class", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 8, "x": 8, "y": 0 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum by (status_class) (rate(http_requests_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "{{status_class}}" }
|
|
]
|
|
},
|
|
{
|
|
"id": 3, "title": "5xx error rate", "type": "stat",
|
|
"gridPos": { "h": 6, "w": 8, "x": 16, "y": 0 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum(rate(http_requests_total{status_class=\"5xx\",job=\"farmafinder-backend\"}[5m])) / sum(rate(http_requests_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "5xx ratio" }
|
|
],
|
|
"fieldConfig": { "defaults": { "unit": "percentunit", "thresholds": { "steps": [ { "color": "green", "value": 0 }, { "color": "yellow", "value": 0.01 }, { "color": "red", "value": 0.05 } ] } } }
|
|
},
|
|
{
|
|
"id": 4, "title": "HTTP p95 latency (route)", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 12, "x": 0, "y": 6 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "histogram_quantile(0.95, sum by (le, route) (rate(http_request_duration_ms_bucket{job=\"farmafinder-backend\"}[5m])))", "legendFormat": "{{route}} p95" }
|
|
],
|
|
"fieldConfig": { "defaults": { "unit": "ms" } }
|
|
},
|
|
{
|
|
"id": 5, "title": "Medicine searches / CIMA requests", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 12, "x": 12, "y": 6 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum(rate(medicine_searches_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "searches/s" },
|
|
{ "expr": "sum(rate(cima_requests_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "cima req/s" }
|
|
]
|
|
},
|
|
{
|
|
"id": 6, "title": "Cache hit ratio", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 8, "x": 0, "y": 12 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum(rate(cache_hits_total{job=\"farmafinder-backend\"}[5m])) / (sum(rate(cache_hits_total{job=\"farmafinder-backend\"}[5m])) + sum(rate(cache_misses_total{job=\"farmafinder-backend\"}[5m])))", "legendFormat": "hit ratio" }
|
|
],
|
|
"fieldConfig": { "defaults": { "unit": "percentunit" } }
|
|
},
|
|
{
|
|
"id": 7, "title": "CIMA API errors", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 8, "x": 8, "y": 12 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum(rate(cima_requests_total{status=\"error\",job=\"farmafinder-backend\"}[5m]))", "legendFormat": "errors/s" }
|
|
]
|
|
},
|
|
{
|
|
"id": 8, "title": "Logins (success / failure)", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 8, "x": 16, "y": 12 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum(rate(login_success_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "success/s" },
|
|
{ "expr": "sum(rate(login_failure_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "failure/s" }
|
|
]
|
|
},
|
|
{
|
|
"id": 9, "title": "Rate-limit rejections (by route)", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 12, "x": 0, "y": 18 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum by (route) (rate(rate_limit_rejected_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "{{route}}" }
|
|
]
|
|
},
|
|
{
|
|
"id": 10, "title": "Push notifications (sent / failed)", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 12, "x": 12, "y": 18 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum by (channel) (rate(push_sent_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "sent {{channel}}" },
|
|
{ "expr": "sum by (channel) (rate(push_failed_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "failed {{channel}}" }
|
|
]
|
|
},
|
|
{
|
|
"id": 11, "title": "DB query p95 latency & errors", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 12, "x": 0, "y": 24 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "histogram_quantile(0.95, sum by (le, engine) (rate(db_query_duration_ms_bucket{job=\"farmafinder-backend\"}[5m])))", "legendFormat": "p95 {{engine}}" },
|
|
{ "expr": "sum by (engine) (rate(db_errors_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "errors {{engine}}" }
|
|
],
|
|
"fieldConfig": { "defaults": { "unit": "ms" } }
|
|
},
|
|
{
|
|
"id": 12, "title": "Redis cmd p95 & errors", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 12, "x": 12, "y": 24 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "histogram_quantile(0.95, sum by (le) (rate(redis_cmd_duration_ms_bucket{job=\"farmafinder-backend\"}[5m])))", "legendFormat": "p95 redis" },
|
|
{ "expr": "sum(rate(redis_errors_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "redis errors/s" }
|
|
],
|
|
"fieldConfig": { "defaults": { "unit": "ms" } }
|
|
},
|
|
{
|
|
"id": 13, "title": "Admin ops (pharmacy writes / links)", "type": "timeseries",
|
|
"gridPos": { "h": 6, "w": 12, "x": 0, "y": 30 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "sum by (op) (rate(pharmacy_write_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "pharmacy {{op}}" },
|
|
{ "expr": "sum by (op) (rate(pharmacy_medicine_link_total{job=\"farmafinder-backend\"}[5m]))", "legendFormat": "link {{op}}" }
|
|
]
|
|
},
|
|
{
|
|
"id": 14, "title": "Liveness (heartbeat)", "type": "stat",
|
|
"gridPos": { "h": 6, "w": 12, "x": 12, "y": 30 },
|
|
"datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" },
|
|
"targets": [
|
|
{ "expr": "max(app_heartbeat_total{job=\"farmafinder-backend\"})", "legendFormat": "heartbeat total" }
|
|
]
|
|
}
|
|
],
|
|
"schemaVersion": 39,
|
|
"style": "dark",
|
|
"tags": ["farmafinder", "backend"],
|
|
"templating": { "list": [] },
|
|
"time": { "from": "now-6h", "to": "now" },
|
|
"timepicker": {},
|
|
"timezone": "browser",
|
|
"title": "FarmaFinder — Backend",
|
|
"uid": "farmafinder-backend",
|
|
"version": 1,
|
|
"weekStart": ""
|
|
}
|