Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ec2e96

Browse files
authored
chore: tidy up grafana example dashboard (#8056)
1 parent 137b51e commit 3ec2e96

File tree

3 files changed

+63
-26
lines changed

3 files changed

+63
-26
lines changed

coderd/coderd.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ import (
3636
"tailscale.com/types/key"
3737
"tailscale.com/util/singleflight"
3838

39-
"cdr.dev/slog"
40-
41-
"github.com/coder/coder/buildinfo"
42-
"github.com/coder/coder/codersdk/agentsdk"
43-
4439
// Used for swagger docs.
4540
_ "github.com/coder/coder/coderd/apidoc"
41+
42+
"cdr.dev/slog"
43+
"github.com/coder/coder/buildinfo"
4644
"github.com/coder/coder/coderd/audit"
4745
"github.com/coder/coder/coderd/awsidentity"
4846
"github.com/coder/coder/coderd/database"
@@ -64,6 +62,7 @@ import (
6462
"github.com/coder/coder/coderd/workspaceapps"
6563
"github.com/coder/coder/coderd/wsconncache"
6664
"github.com/coder/coder/codersdk"
65+
"github.com/coder/coder/codersdk/agentsdk"
6766
"github.com/coder/coder/provisionerd/proto"
6867
"github.com/coder/coder/provisionersdk"
6968
"github.com/coder/coder/site"

examples/monitoring/dashboards/grafana/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Grafana Example Dashboard
22

3-
![image](https://github.com/coder/coder/assets/6332295/1dd61c3c-9fa5-4ff4-87ff-6cd840f9f7d6)
3+
![image](https://github.com/coder/coder/assets/6332295/00135fb6-5678-42c2-8679-a20f345ff197)
44

55
Download `dashboard.json` and import it into your Grafana instance. It has two
66
filter variables which can be used to select the label you set for your Coder

examples/monitoring/dashboards/grafana/dashboard.json

+58-20
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,24 @@
128128
]
129129
}
130130
},
131-
"overrides": []
131+
"overrides": [
132+
{
133+
"matcher": {
134+
"id": "byRegexp",
135+
"options": "/.*/"
136+
},
137+
"properties": [
138+
{
139+
"id": "displayName",
140+
"value": "CPU seconds"
141+
},
142+
{
143+
"id": "unit",
144+
"value": "s"
145+
}
146+
]
147+
}
148+
]
132149
},
133150
"gridPos": {
134151
"h": 8,
@@ -413,15 +430,27 @@
413430
"overrides": [
414431
{
415432
"matcher": {
416-
"id": "byName",
417-
"options": "{__name__=\"coderd_provisionerd_num_daemons\", app=\"coderd\", instance=\"coder:2112\", job=\"coderd\"}"
433+
"id": "byRegexp",
434+
"options": "/coderd_provisionerd_num_daemons/"
418435
},
419436
"properties": [
420437
{
421438
"id": "displayName",
422439
"value": "Running provisioners"
423440
}
424441
]
442+
},
443+
{
444+
"matcher": {
445+
"id": "byRegexp",
446+
"options": "/coderd_provisionerd_jobs_current/"
447+
},
448+
"properties": [
449+
{
450+
"id": "displayName",
451+
"value": "Running jobs"
452+
}
453+
]
425454
}
426455
]
427456
},
@@ -531,8 +560,8 @@
531560
"overrides": [
532561
{
533562
"matcher": {
534-
"id": "byName",
535-
"options": "sum(rate(coderd_db_query_latencies_seconds_count[1m0s]))"
563+
"id": "byRegexp",
564+
"options": "/.*coderd_db_query_latencies_seconds_count.*/"
536565
},
537566
"properties": [
538567
{
@@ -547,13 +576,13 @@
547576
},
548577
{
549578
"matcher": {
550-
"id": "byName",
551-
"options": "histogram_quantile(0.95, sum by(le) (rate(coderd_db_query_latencies_seconds_bucket[1m0s])))"
579+
"id": "byRegexp",
580+
"options": "/.*coderd_db_query_latencies_seconds_bucket.*/"
552581
},
553582
"properties": [
554583
{
555584
"id": "displayName",
556-
"value": "P95 latency"
585+
"value": "P95 query latency"
557586
}
558587
]
559588
}
@@ -666,8 +695,8 @@
666695
"overrides": [
667696
{
668697
"matcher": {
669-
"id": "byName",
670-
"options": "{__name__=\"go_memstats_alloc_bytes\", app=\"coderd\", instance=\"coder:2112\", job=\"coderd\"}"
698+
"id": "byRegexp",
699+
"options": "/go_memstats_alloc_bytes/"
671700
},
672701
"properties": [
673702
{
@@ -686,8 +715,8 @@
686715
},
687716
{
688717
"matcher": {
689-
"id": "byName",
690-
"options": "{__name__=\"go_goroutines\", app=\"coderd\", instance=\"coder:2112\", job=\"coderd\"}"
718+
"id": "byRegexp",
719+
"options": "/go_goroutines/"
691720
},
692721
"properties": [
693722
{
@@ -804,32 +833,40 @@
804833
"overrides": [
805834
{
806835
"matcher": {
807-
"id": "byName",
808-
"options": "sum(rate(coderd_api_requests_processed_total{code=\"500\"}[1m0s]))"
836+
"id": "byRegexp",
837+
"options": "/coderd_api_requests_processed_total{code=\"500\"}/"
809838
},
810839
"properties": [
811840
{
812841
"id": "displayName",
813842
"value": "Error rate"
843+
},
844+
{
845+
"id": "unit",
846+
"value": "reqps"
814847
}
815848
]
816849
},
817850
{
818851
"matcher": {
819-
"id": "byName",
820-
"options": "coderd"
852+
"id": "byRegexp",
853+
"options": "/coderd_api_requests_processed_total/"
821854
},
822855
"properties": [
823856
{
824857
"id": "displayName",
825858
"value": "Request rate"
859+
},
860+
{
861+
"id": "unit",
862+
"value": "reqps"
826863
}
827864
]
828865
},
829866
{
830867
"matcher": {
831-
"id": "byName",
832-
"options": "histogram_quantile(0.95, sum by(le) (rate(coderd_api_request_latencies_seconds_bucket[1m0s])))"
868+
"id": "byRegexp",
869+
"options": "/coderd_api_request_latencies_seconds_bucket/"
833870
},
834871
"properties": [
835872
{
@@ -870,7 +907,8 @@
870907
"uid": "${DS_PROMETHEUS}"
871908
},
872909
"editorMode": "builder",
873-
"expr": "sum by(job) (rate(coderd_api_requests_processed_total{$filter_key=\"$filter_value\"}[$__rate_interval]))",
910+
"expr": "sum(rate(coderd_api_requests_processed_total{$filter_key=\"$filter_value\"}[$__rate_interval]))",
911+
"interval": "",
874912
"legendFormat": "__auto",
875913
"range": true,
876914
"refId": "A"
@@ -962,6 +1000,6 @@
9621000
"timezone": "",
9631001
"title": "Coder Dashboard",
9641002
"uid": "cb63c6ac-e392-42a9-a966-ee642b9c997c",
965-
"version": 9,
1003+
"version": 10,
9661004
"weekStart": ""
9671005
}

0 commit comments

Comments
 (0)