Skip to content

Commit 39250a8

Browse files
committed
feat(monitoring): update prometheus config and grafana backend metrics dashboard
1 parent 2de50df commit 39250a8

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed
Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1-
// infra/monitoring/grafana/dashboards/backend_metrics.json
1+
{
2+
"title": "Serotonin Backend & Worker Metrics",
3+
"timezone": "browser",
4+
"refresh": "10s",
5+
"panels": [
6+
{
7+
"title": "Worker Task Logs (Live)",
8+
"type": "logs",
9+
"gridPos": { "h": 12, "w": 24, "x": 0, "y": 0 },
10+
"targets": [
11+
{
12+
"expr": "{container=~\\\".*worker.*\\\"} | json",
13+
"refId": "A"
14+
}
15+
],
16+
"options": {
17+
"showTime": true,
18+
"showLabels": false,
19+
"showCommonLabels": false,
20+
"wrapLogMessage": true
21+
}
22+
},
23+
{
24+
"title": "Task Execution Time (Average per minute)",
25+
"type": "timeseries",
26+
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 12 },
27+
"targets": [
28+
{
29+
"expr": "avg_over_time({container=~\\\".*worker.*\\\"} | json | unwrap execution_time_sec [1m])",
30+
"refId": "A",
31+
"legendFormat": "Execution Time (sec)"
32+
}
33+
],
34+
"options": {
35+
"tooltip": { "mode": "single", "sort": "none" }
36+
}
37+
},
38+
{
39+
"title": "Errors Rate (Backend & Worker)",
40+
"type": "timeseries",
41+
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 12 },
42+
"targets": [
43+
{
44+
"expr": "sum(rate({container=~\\\".*serotonin_script.*\\\", level=\\\"error\\\"}[5m])) by (container)",
45+
"refId": "A"
46+
}
47+
]
48+
}
49+
],
50+
"schemaVersion": 38
51+
}

infra/monitoring/prometheus/prometheus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ global:
55
scrape_configs:
66
- job_name: "seratonin-api"
77
static_configs:
8-
- targets: ["host.docker.internal:8001"]
8+
- targets: ["backend:8001"]
99

1010
- job_name: "seratonin-worker"
1111
static_configs:
12-
- targets: ["host.docker.internal:9000"]
12+
- targets: ["worker:9000"]
1313

1414
- job_name: "prometheus"
1515
static_configs:

0 commit comments

Comments
 (0)