diff --git a/tdrs-backend/plg/grafana/dashboards/dev_logs_dashboard.json b/tdrs-backend/plg/grafana/dashboards/dev_logs_dashboard.json index 7fc27f8d5..1a1eecacc 100644 --- a/tdrs-backend/plg/grafana/dashboards/dev_logs_dashboard.json +++ b/tdrs-backend/plg/grafana/dashboards/dev_logs_dashboard.json @@ -97,6 +97,35 @@ "skipUrlSync": false, "sort": 0, "type": "query" + }, + { + "current": { + "selected": false, + "text": "DEBUG", + "value": "DEBUG" + }, + "datasource": { + "type": "loki", + "uid": "L8E80F9AEF21F6940" + }, + "definition": "", + "hide": 0, + "includeAll": false, + "label": "level", + "multi": false, + "name": "level", + "options": [], + "query": { + "label": "level", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" } ] }, diff --git a/tdrs-backend/plg/grafana/dashboards/logs_dashboard.json b/tdrs-backend/plg/grafana/dashboards/logs_dashboard.json index ef2c34f56..ef1d48841 100644 --- a/tdrs-backend/plg/grafana/dashboards/logs_dashboard.json +++ b/tdrs-backend/plg/grafana/dashboards/logs_dashboard.json @@ -23,6 +23,94 @@ "panels": [ { "datasource": { + "default": true, + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "dark-red", + "value": 80 + }, + { + "color": "light-red", + "value": 85 + }, + { + "color": "#EAB839", + "value": 90 + }, + { + "color": "semi-dark-green", + "value": 95 + }, + { + "color": "dark-green", + "value": 100 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 14, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "100 * avg_over_time(up{job=~\"$app\"}[$__range])", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "App Uptime", + "type": "stat" + }, + { + "datasource": { + "default": false, "type": "loki", "uid": "L8E80F9AEF21F6940" }, @@ -50,7 +138,7 @@ "uid": "L8E80F9AEF21F6940" }, "editorMode": "code", - "expr": "{job=~\"$job\"}", + "expr": "{job=~\"$job\", level=~\"$level\"}", "queryType": "range", "refId": "A" } @@ -97,6 +185,62 @@ "skipUrlSync": false, "sort": 0, "type": "query" + }, + { + "current": { + "selected": true, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "definition": "query_result(up)", + "hide": 0, + "includeAll": true, + "label": "App", + "multi": false, + "name": "app", + "options": [], + "query": { + "qryType": 3, + "query": "query_result(up)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "/.*job=\"([^\"]+).*/", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "loki", + "uid": "L8E80F9AEF21F6940" + }, + "definition": "", + "hide": 0, + "includeAll": true, + "multi": false, + "name": "level", + "options": [], + "query": { + "label": "level", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" } ] }, diff --git a/tdrs-backend/plg/promtail/config.local.yml b/tdrs-backend/plg/promtail/config.local.yml index dc6eb0da4..4fe0ccfda 100644 --- a/tdrs-backend/plg/promtail/config.local.yml +++ b/tdrs-backend/plg/promtail/config.local.yml @@ -24,6 +24,14 @@ scrape_configs: labels: job: backend-local __path__: /logs/django.log + pipeline_stages: + - regex: + expression: '^(?P