ci: extend grafana logs dashboard

This commit is contained in:
Lars Hampe 2024-11-12 21:56:28 +01:00
parent 0787122c25
commit 6c5f7c08b5
6 changed files with 232 additions and 21 deletions

View File

@ -30,24 +30,28 @@ services:
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
entrypoint:
- sh
- -euc
- |
mkdir -p /etc/grafana/provisioning/datasources
cat <<EOF > /etc/grafana/provisioning/datasources/ds.yaml
apiVersion: 1
datasources:
- name: Loki
type: loki
access: proxy
orgId: 1
url: http://loki:3100
basicAuth: false
isDefault: true
version: 1
editable: false
EOF
/run.sh
volumes:
- ./grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/main.yaml
- ./grafana/dashboards:/var/lib/grafana/dashboards
- ./grafana/datasources:/etc/grafana/provisioning/datasources
# entrypoint:
# - sh
# - -euc
# - |
# mkdir -p /etc/grafana/provisioning/datasources
# cat <<EOF > /etc/grafana/provisioning/datasources/ds.yaml
# apiVersion: 1
# datasources:
# - name: Loki
# type: loki
# access: proxy
# orgId: 1
# url: http://loki:3100
# basicAuth: false
# isDefault: true
# version: 1
# editable: false
# EOF
# /run.sh
ports:
- "9000:3000"

View File

@ -0,0 +1,12 @@
apiVersion: 1
providers:
- name: "Dashboard provider"
orgId: 1
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: false
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true

View File

@ -205,6 +205,177 @@
"title": "400 - 499",
"type": "stat"
},
{
"datasource": {
"type": "loki",
"uid": "P8E80F9AEF21F6940"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "blue",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 4,
"x": 0,
"y": 9
},
"id": 7,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": ["sum"],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.3.0",
"targets": [
{
"editorMode": "builder",
"expr": "count(rate({service=\"api\"} | json | level = `info` [$__auto]))",
"queryType": "range",
"refId": "A"
}
],
"title": "Info",
"type": "stat"
},
{
"datasource": {
"type": "loki",
"uid": "P8E80F9AEF21F6940"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "yellow",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 4,
"x": 4,
"y": 9
},
"id": 8,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": ["sum"],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.3.0",
"targets": [
{
"editorMode": "builder",
"expr": "count(rate({service=\"api\"} | json | level = `warn` [$__auto]))",
"queryType": "range",
"refId": "A"
}
],
"title": "Warning",
"type": "stat"
},
{
"datasource": {
"type": "loki",
"uid": "P8E80F9AEF21F6940"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 4,
"x": 8,
"y": 9
},
"id": 9,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": ["sum"],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.3.0",
"targets": [
{
"editorMode": "builder",
"expr": "count(rate({service=\"api\"} | json | level = `error` [$__auto]))",
"queryType": "range",
"refId": "A"
}
],
"title": "Error",
"type": "stat"
},
{
"datasource": {
"type": "loki",
@ -218,7 +389,7 @@
"h": 17,
"w": 24,
"x": 0,
"y": 9
"y": 17
},
"id": 5,
"options": {
@ -258,6 +429,6 @@
"timezone": "browser",
"title": "Logging",
"uid": "be3r0x46iwlq8f",
"version": 12,
"version": 1,
"weekStart": "monday"
}

View File

@ -0,0 +1,12 @@
apiVersion: 1
providers:
- name: "Dashboard provider"
orgId: 1
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: false
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true

View File

@ -0,0 +1,11 @@
apiVersion: 1
datasources:
- name: Loki
type: loki
access: proxy
orgId: 1
url: http://loki:3100
basicAuth: false
isDefault: true
version: 1
editable: false

View File

@ -8,6 +8,7 @@
"dev": "bun --filter '*' dev",
"dev:docker:up": "docker compose -f ci/development/docker-compose.yaml up -d",
"dev:docker:down": "docker compose -f ci/development/docker-compose.yaml down",
"dev:docker:stop": "docker compose -f ci/development/docker-compose.yaml stop",
"build": "bun --filter '*' build",
"db:generate": "bun --filter '@boring.tools/database' db:generate",
"db:migrate": "bun --filter '@boring.tools/database' db:migrate",