Skip to content

Commit be3dffc

Browse files
feat: Add infrastructure logs and relab API dashboards
1 parent f6e857f commit be3dffc

3 files changed

Lines changed: 252 additions & 2 deletions

File tree

config/grafana/datasources.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,3 @@ datasources:
4646
enabled: true
4747
search:
4848
hide: false
49-
streamingEnabled:
50-
search: true
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"title": "RELab — Container Logs",
3+
"uid": "relab-infra-logs",
4+
"schemaVersion": 39,
5+
"version": 1,
6+
"refresh": "30s",
7+
"time": { "from": "now-1h", "to": "now" },
8+
"graphTooltip": 1,
9+
"tags": ["relab"],
10+
"templating": {
11+
"list": [
12+
{
13+
"name": "env",
14+
"label": "Environment",
15+
"type": "custom",
16+
"query": "staging,prod",
17+
"current": { "text": "staging", "value": "staging" },
18+
"options": [
19+
{ "text": "staging", "value": "staging", "selected": true },
20+
{ "text": "prod", "value": "prod", "selected": false }
21+
],
22+
"hide": 0
23+
},
24+
{
25+
"name": "service",
26+
"label": "Service",
27+
"type": "query",
28+
"datasource": { "type": "loki", "uid": "loki" },
29+
"definition": "label_values({env=\"$env\"}, service)",
30+
"query": { "type": "labelValues", "label": "service", "stream": "{env=\"$env\"}" },
31+
"refresh": 2,
32+
"sort": 1,
33+
"multi": true,
34+
"includeAll": true,
35+
"allValue": ".+",
36+
"current": { "text": "All", "value": "$__all" },
37+
"options": [],
38+
"hide": 0
39+
}
40+
]
41+
},
42+
"panels": [
43+
{
44+
"type": "timeseries",
45+
"title": "Log Rate by Service",
46+
"gridPos": { "h": 8, "w": 24, "x": 0, "y": 0 },
47+
"id": 1,
48+
"datasource": { "type": "loki", "uid": "loki" },
49+
"targets": [
50+
{
51+
"expr": "sum by (service) (rate({env=\"$env\", service=~\"$service\"}[$__auto]))",
52+
"legendFormat": "{{service}}",
53+
"refId": "A"
54+
}
55+
],
56+
"fieldConfig": {
57+
"defaults": {
58+
"unit": "reqps",
59+
"custom": { "lineWidth": 2, "fillOpacity": 10 }
60+
}
61+
},
62+
"options": {
63+
"tooltip": { "mode": "multi", "sort": "desc" },
64+
"legend": { "displayMode": "list", "placement": "bottom" }
65+
}
66+
},
67+
{
68+
"type": "logs",
69+
"title": "All Container Logs",
70+
"gridPos": { "h": 12, "w": 24, "x": 0, "y": 8 },
71+
"id": 2,
72+
"datasource": { "type": "loki", "uid": "loki" },
73+
"targets": [
74+
{
75+
"expr": "{env=\"$env\", service=~\"$service\"}",
76+
"refId": "A"
77+
}
78+
],
79+
"options": {
80+
"dedupStrategy": "none",
81+
"showLabels": true,
82+
"wrapLogMessage": false,
83+
"enableLogDetails": true,
84+
"sortOrder": "Descending"
85+
}
86+
},
87+
{
88+
"type": "logs",
89+
"title": "Errors & Warnings",
90+
"gridPos": { "h": 10, "w": 24, "x": 0, "y": 20 },
91+
"id": 3,
92+
"datasource": { "type": "loki", "uid": "loki" },
93+
"targets": [
94+
{
95+
"expr": "{env=\"$env\", service=~\"$service\"} |~ `(?i)(error|fatal|panic|exception|warn)`",
96+
"refId": "A"
97+
}
98+
],
99+
"options": {
100+
"dedupStrategy": "none",
101+
"showLabels": true,
102+
"wrapLogMessage": true,
103+
"enableLogDetails": true,
104+
"sortOrder": "Descending"
105+
}
106+
}
107+
],
108+
"annotations": { "list": [] }
109+
}

dashboards/relab-api.json

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
"title": "RELab — API",
3+
"uid": "relab-api",
4+
"schemaVersion": 39,
5+
"version": 1,
6+
"refresh": "30s",
7+
"time": { "from": "now-1h", "to": "now" },
8+
"graphTooltip": 1,
9+
"tags": ["relab"],
10+
"panels": [
11+
{
12+
"type": "row",
13+
"title": "Logs",
14+
"collapsed": false,
15+
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 },
16+
"id": 1
17+
},
18+
{
19+
"type": "timeseries",
20+
"title": "Log Rate by Level",
21+
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 1 },
22+
"id": 2,
23+
"datasource": { "type": "loki", "uid": "loki" },
24+
"targets": [
25+
{
26+
"expr": "sum by (detected_level) (rate({service_name=\"relab-api\"}[$__auto]))",
27+
"legendFormat": "{{detected_level}}",
28+
"refId": "A"
29+
}
30+
],
31+
"fieldConfig": {
32+
"defaults": {
33+
"unit": "reqps",
34+
"custom": { "lineWidth": 2, "fillOpacity": 10 }
35+
},
36+
"overrides": [
37+
{
38+
"matcher": { "id": "byName", "options": "error" },
39+
"properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "red" } }]
40+
},
41+
{
42+
"matcher": { "id": "byName", "options": "critical" },
43+
"properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "dark-red" } }]
44+
},
45+
{
46+
"matcher": { "id": "byName", "options": "warning" },
47+
"properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "orange" } }]
48+
},
49+
{
50+
"matcher": { "id": "byName", "options": "info" },
51+
"properties": [{ "id": "color", "value": { "mode": "fixed", "fixedColor": "blue" } }]
52+
}
53+
]
54+
},
55+
"options": {
56+
"tooltip": { "mode": "multi", "sort": "desc" },
57+
"legend": { "displayMode": "list", "placement": "bottom" }
58+
}
59+
},
60+
{
61+
"type": "logs",
62+
"title": "Log Stream",
63+
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 1 },
64+
"id": 3,
65+
"datasource": { "type": "loki", "uid": "loki" },
66+
"targets": [
67+
{
68+
"expr": "{service_name=\"relab-api\"}",
69+
"refId": "A"
70+
}
71+
],
72+
"options": {
73+
"dedupStrategy": "none",
74+
"showLabels": false,
75+
"wrapLogMessage": true,
76+
"prettifyLogMessage": false,
77+
"enableLogDetails": true,
78+
"sortOrder": "Descending"
79+
}
80+
},
81+
{
82+
"type": "logs",
83+
"title": "Errors",
84+
"gridPos": { "h": 7, "w": 24, "x": 0, "y": 9 },
85+
"id": 6,
86+
"datasource": { "type": "loki", "uid": "loki" },
87+
"targets": [
88+
{
89+
"expr": "{service_name=\"relab-api\", detected_level=~\"error|critical\"}",
90+
"refId": "A"
91+
}
92+
],
93+
"options": {
94+
"dedupStrategy": "none",
95+
"showLabels": false,
96+
"wrapLogMessage": true,
97+
"enableLogDetails": true,
98+
"sortOrder": "Descending"
99+
}
100+
},
101+
{
102+
"type": "row",
103+
"title": "Traces",
104+
"collapsed": false,
105+
"gridPos": { "h": 1, "w": 24, "x": 0, "y": 16 },
106+
"id": 4
107+
},
108+
{
109+
"type": "traces",
110+
"title": "Recent Traces",
111+
"gridPos": { "h": 12, "w": 24, "x": 0, "y": 17 },
112+
"id": 5,
113+
"datasource": { "type": "tempo", "uid": "tempo" },
114+
"targets": [
115+
{
116+
"queryType": "traceql",
117+
"query": "{resource.service.name=\"relab-api\"}",
118+
"refId": "A",
119+
"tableType": "traces"
120+
}
121+
],
122+
"options": { "frameType": "TraceqlSearch" }
123+
},
124+
{
125+
"type": "traces",
126+
"title": "Failed Requests",
127+
"gridPos": { "h": 10, "w": 24, "x": 0, "y": 29 },
128+
"id": 7,
129+
"datasource": { "type": "tempo", "uid": "tempo" },
130+
"targets": [
131+
{
132+
"queryType": "traceql",
133+
"query": "{resource.service.name=\"relab-api\" && status=error}",
134+
"refId": "A",
135+
"tableType": "traces"
136+
}
137+
],
138+
"options": { "frameType": "TraceqlSearch" }
139+
}
140+
],
141+
"templating": { "list": [] },
142+
"annotations": { "list": [] }
143+
}

0 commit comments

Comments
 (0)