From 47420827772ea78278d1354d8ab872b4ea8d9f99 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Thu, 15 Jun 2023 19:08:27 +0000 Subject: [PATCH] chore: tidy up grafana example dashboard --- coderd/coderd.go | 9 +-- .../monitoring/dashboards/grafana/README.md | 2 +- .../dashboards/grafana/dashboard.json | 78 ++++++++++++++----- 3 files changed, 63 insertions(+), 26 deletions(-) diff --git a/coderd/coderd.go b/coderd/coderd.go index 1bb12c6708a14..fe59fd8726467 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -36,13 +36,11 @@ import ( "tailscale.com/types/key" "tailscale.com/util/singleflight" - "cdr.dev/slog" - - "github.com/coder/coder/buildinfo" - "github.com/coder/coder/codersdk/agentsdk" - // Used for swagger docs. _ "github.com/coder/coder/coderd/apidoc" + + "cdr.dev/slog" + "github.com/coder/coder/buildinfo" "github.com/coder/coder/coderd/audit" "github.com/coder/coder/coderd/awsidentity" "github.com/coder/coder/coderd/database" @@ -64,6 +62,7 @@ import ( "github.com/coder/coder/coderd/workspaceapps" "github.com/coder/coder/coderd/wsconncache" "github.com/coder/coder/codersdk" + "github.com/coder/coder/codersdk/agentsdk" "github.com/coder/coder/provisionerd/proto" "github.com/coder/coder/provisionersdk" "github.com/coder/coder/site" diff --git a/examples/monitoring/dashboards/grafana/README.md b/examples/monitoring/dashboards/grafana/README.md index 460338914cb07..c883b399cec0e 100644 --- a/examples/monitoring/dashboards/grafana/README.md +++ b/examples/monitoring/dashboards/grafana/README.md @@ -1,6 +1,6 @@ # Grafana Example Dashboard -![image](https://github.com/coder/coder/assets/6332295/1dd61c3c-9fa5-4ff4-87ff-6cd840f9f7d6) +![image](https://github.com/coder/coder/assets/6332295/00135fb6-5678-42c2-8679-a20f345ff197) Download `dashboard.json` and import it into your Grafana instance. It has two filter variables which can be used to select the label you set for your Coder diff --git a/examples/monitoring/dashboards/grafana/dashboard.json b/examples/monitoring/dashboards/grafana/dashboard.json index c16ba52534ed9..60fc2f108d08c 100644 --- a/examples/monitoring/dashboards/grafana/dashboard.json +++ b/examples/monitoring/dashboards/grafana/dashboard.json @@ -128,7 +128,24 @@ ] } }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/.*/" + }, + "properties": [ + { + "id": "displayName", + "value": "CPU seconds" + }, + { + "id": "unit", + "value": "s" + } + ] + } + ] }, "gridPos": { "h": 8, @@ -413,8 +430,8 @@ "overrides": [ { "matcher": { - "id": "byName", - "options": "{__name__=\"coderd_provisionerd_num_daemons\", app=\"coderd\", instance=\"coder:2112\", job=\"coderd\"}" + "id": "byRegexp", + "options": "/coderd_provisionerd_num_daemons/" }, "properties": [ { @@ -422,6 +439,18 @@ "value": "Running provisioners" } ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/coderd_provisionerd_jobs_current/" + }, + "properties": [ + { + "id": "displayName", + "value": "Running jobs" + } + ] } ] }, @@ -531,8 +560,8 @@ "overrides": [ { "matcher": { - "id": "byName", - "options": "sum(rate(coderd_db_query_latencies_seconds_count[1m0s]))" + "id": "byRegexp", + "options": "/.*coderd_db_query_latencies_seconds_count.*/" }, "properties": [ { @@ -547,13 +576,13 @@ }, { "matcher": { - "id": "byName", - "options": "histogram_quantile(0.95, sum by(le) (rate(coderd_db_query_latencies_seconds_bucket[1m0s])))" + "id": "byRegexp", + "options": "/.*coderd_db_query_latencies_seconds_bucket.*/" }, "properties": [ { "id": "displayName", - "value": "P95 latency" + "value": "P95 query latency" } ] } @@ -666,8 +695,8 @@ "overrides": [ { "matcher": { - "id": "byName", - "options": "{__name__=\"go_memstats_alloc_bytes\", app=\"coderd\", instance=\"coder:2112\", job=\"coderd\"}" + "id": "byRegexp", + "options": "/go_memstats_alloc_bytes/" }, "properties": [ { @@ -686,8 +715,8 @@ }, { "matcher": { - "id": "byName", - "options": "{__name__=\"go_goroutines\", app=\"coderd\", instance=\"coder:2112\", job=\"coderd\"}" + "id": "byRegexp", + "options": "/go_goroutines/" }, "properties": [ { @@ -804,32 +833,40 @@ "overrides": [ { "matcher": { - "id": "byName", - "options": "sum(rate(coderd_api_requests_processed_total{code=\"500\"}[1m0s]))" + "id": "byRegexp", + "options": "/coderd_api_requests_processed_total{code=\"500\"}/" }, "properties": [ { "id": "displayName", "value": "Error rate" + }, + { + "id": "unit", + "value": "reqps" } ] }, { "matcher": { - "id": "byName", - "options": "coderd" + "id": "byRegexp", + "options": "/coderd_api_requests_processed_total/" }, "properties": [ { "id": "displayName", "value": "Request rate" + }, + { + "id": "unit", + "value": "reqps" } ] }, { "matcher": { - "id": "byName", - "options": "histogram_quantile(0.95, sum by(le) (rate(coderd_api_request_latencies_seconds_bucket[1m0s])))" + "id": "byRegexp", + "options": "/coderd_api_request_latencies_seconds_bucket/" }, "properties": [ { @@ -870,7 +907,8 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "builder", - "expr": "sum by(job) (rate(coderd_api_requests_processed_total{$filter_key=\"$filter_value\"}[$__rate_interval]))", + "expr": "sum(rate(coderd_api_requests_processed_total{$filter_key=\"$filter_value\"}[$__rate_interval]))", + "interval": "", "legendFormat": "__auto", "range": true, "refId": "A" @@ -962,6 +1000,6 @@ "timezone": "", "title": "Coder Dashboard", "uid": "cb63c6ac-e392-42a9-a966-ee642b9c997c", - "version": 9, + "version": 10, "weekStart": "" }