f32ff701e1
Run Tests on Branches / Detect Changes (push) Successful in 14s
Run Tests on Branches / Backend Tests (push) Successful in 4m3s
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Has been skipped
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
- Fix OTel custom metrics not reaching Prometheus: ESM static import hoisting caused metrics.getMeter() to run before sdk.start(), getting NoopMeterProvider. Changed to lazy-init pattern so instruments are created on first use after the SDK configures the real MeterProvider. - Fix Grafana dashboards job labels: OTel adds service.namespace prefix (job=farmafinder/farmafinder-backend), updated queries to use regex match (job=~".*farmafinder-backend"). - Fix histogram metric names: OTel appends unit suffix (_milliseconds) to histogram names (e.g. http_request_duration_ms_milliseconds_bucket). Verified: app_heartbeat_total, http_requests_total, db_query_duration_ms, redis_cmd_duration_ms, and all other custom metrics now flow correctly through OTLP -> Alloy -> Prometheus remote_write.
146 lines
7.1 KiB
JSON
146 lines
7.1 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_milliseconds_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_milliseconds_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_milliseconds_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": 2,
|
|
"weekStart": ""
|
|
}
|