From 5dc8d9e9bfa190ea1dbe255f5d4ba95084114622 Mon Sep 17 00:00:00 2001 From: capJavert Date: Tue, 16 Jan 2024 12:44:37 +0100 Subject: [PATCH] feat: add job variable to dashboard meilisearch job_name was hardcoded in the dashboard config so if user sets anything but meilisearch as job_name on prometheus side the dashboard does not work see: https://github.com/orgs/meilisearch/discussions/625#discussioncomment-8143282 --- assets/grafana-dashboard.json | 57 ++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/assets/grafana-dashboard.json b/assets/grafana-dashboard.json index 98695a1d2..37f7b1ca2 100644 --- a/assets/grafana-dashboard.json +++ b/assets/grafana-dashboard.json @@ -106,7 +106,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "meilisearch_index_count{job=\"meilisearch\", instance=\"$instance\"}", + "expr": "meilisearch_index_count{job=\"$job\", instance=\"$instance\"}", "interval": "", "legendFormat": "", "range": true, @@ -165,7 +165,7 @@ "type": "prometheus" }, "editorMode": "builder", - "expr": "meilisearch_index_docs_count{job=\"meilisearch\", index=\"$Index\", instance=\"$instance\"}", + "expr": "meilisearch_index_docs_count{job=\"$job\", index=\"$Index\", instance=\"$instance\"}", "hide": false, "range": true, "refId": "A" @@ -228,7 +228,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[1h]))", + "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"$job\"}[1h]))", "interval": "", "legendFormat": "", "range": true, @@ -288,7 +288,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[24h]))", + "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"$job\"}[24h]))", "interval": "", "legendFormat": "", "range": true, @@ -348,7 +348,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"meilisearch\"}[30d]))", + "expr": "round(increase(meilisearch_http_requests_total{method=\"POST\", path=\"/indexes/$Index/search\", job=\"$job\"}[30d]))", "interval": "", "legendFormat": "", "range": true, @@ -447,7 +447,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "meilisearch_db_size_bytes{job=\"meilisearch\", instance=\"$instance\"}", + "expr": "meilisearch_db_size_bytes{job=\"$job\", instance=\"$instance\"}", "interval": "", "legendFormat": "Database size on disk", "range": true, @@ -458,7 +458,7 @@ "type": "prometheus" }, "editorMode": "builder", - "expr": "meilisearch_used_db_size_bytes{job=\"meilisearch\", instance=\"$instance\"}", + "expr": "meilisearch_used_db_size_bytes{job=\"$job\", instance=\"$instance\"}", "hide": false, "legendFormat": "Used bytes", "range": true, @@ -553,7 +553,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "rate(meilisearch_http_response_time_seconds_sum{instance=\"$instance\", job=\"meilisearch\"}[5m]) / rate(meilisearch_http_response_time_seconds_count[5m])", + "expr": "rate(meilisearch_http_response_time_seconds_sum{instance=\"$instance\", job=\"$job\"}[5m]) / rate(meilisearch_http_response_time_seconds_count[5m])", "interval": "", "legendFormat": "{{method}} {{path}}", "range": true, @@ -646,7 +646,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "rate(meilisearch_http_requests_total{instance=\"$instance\", job=\"meilisearch\"}[5m])", + "expr": "rate(meilisearch_http_requests_total{instance=\"$instance\", job=\"$job\"}[5m])", "interval": "", "legendFormat": "{{method}} {{path}}", "range": true, @@ -744,7 +744,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "sum by(le) (increase(meilisearch_http_response_time_seconds_bucket{path=\"/indexes/$Index/search\", instance=\"$instance\", job=\"meilisearch\"}[30s]))", + "expr": "sum by(le) (increase(meilisearch_http_response_time_seconds_bucket{path=\"/indexes/$Index/search\", instance=\"$instance\", job=\"$job\"}[30s]))", "format": "heatmap", "interval": "", "legendFormat": "{{le}}", @@ -854,7 +854,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"statuses\"}", + "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"$job\", kind=\"statuses\"}", "interval": "", "legendFormat": "{{value}} ", "range": true, @@ -947,7 +947,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"types\"}", + "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"$job\", kind=\"types\"}", "interval": "", "legendFormat": "{{value}} ", "range": true, @@ -1040,7 +1040,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"meilisearch\", kind=\"indexes\"}", + "expr": "meilisearch_nb_tasks{instance=\"$instance\", job=\"$job\", kind=\"indexes\"}", "interval": "", "legendFormat": "{{value}} ", "range": true, @@ -1161,7 +1161,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "rate(process_cpu_seconds_total{job=\"meilisearch\", instance=\"$instance\"}[1m])", + "expr": "rate(process_cpu_seconds_total{job=\"$job\", instance=\"$instance\"}[1m])", "interval": "", "legendFormat": "process", "range": true, @@ -1264,7 +1264,7 @@ }, "editorMode": "builder", "exemplar": true, - "expr": "process_resident_memory_bytes{job=\"meilisearch\", instance=\"$instance\"} / 1024 / 1024", + "expr": "process_resident_memory_bytes{job=\"$job\", instance=\"$instance\"} / 1024 / 1024", "interval": "", "legendFormat": "process", "range": true, @@ -1342,6 +1342,33 @@ "skipUrlSync": false, "sort": 0, "type": "query" + }, + { + "current": { + "selected": true, + "text": "meilisearch", + "value": "meilisearch" + }, + "datasource": { + "type": "prometheus" + }, + "definition": "label_values(job)", + "description": "Prometheus job_name from scrape config (default is meilisearch)", + "hide": 0, + "includeAll": false, + "label": "Job", + "multi": false, + "name": "job", + "options": [], + "query": { + "query": "label_values(job)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" } ] },