Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 6ec101f

Browse files
committed
Avoid using total suffix for gauge metrics and apply rate for counters
Latest mixtool linter which relies on grafana-linter pkg is failing when gauge metrics with name ending with `total`[1]. [1] https://github.com/grafana/dashboard-linter/blob/44d415fb6bdc4d8e6585e514c448174d4de1ff02/lint/rule_target_counter_agg.go#L30 Signed-off-by: Arunprasad Rajkumar <[email protected]>
1 parent 6974172 commit 6ec101f

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

docs/mixin/.lint

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,3 @@ exclusions:
1010
template-datasource-rule:
1111
target-counter-agg-rule:
1212
reason: "disabled for promscale_sql_database_worker_maintenance_job_locks_total, promscale_sql_database_worker_maintenance_job_long_running_total. This metric should be not have total due to naming conventions as its a gauge, not a counter"
13-
entries:
14-
- dashboard: Promscale
15-
panel: Long running maintenance queries by job type
16-
- dashboard: Promscale
17-
panel: Long running maintenance queries by wait event
18-
- dashboard: Promscale
19-
panel: Locks held by maintenance jobs by lock mode

docs/mixin/dashboards/promscale.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,7 @@
23702370
},
23712371
"editorMode": "code",
23722372
"exemplar": false,
2373-
"expr": "max(promscale_sql_database_worker_maintenance_job_long_running_total{namespace=~\"$namespace\"})",
2373+
"expr": "max(promscale_sql_database_worker_maintenance_job_long_running{namespace=~\"$namespace\"})",
23742374
"interval": "",
23752375
"legendFormat": "total",
23762376
"range": true,
@@ -2918,7 +2918,7 @@
29182918
},
29192919
"editorMode": "code",
29202920
"exemplar": false,
2921-
"expr": "max(promscale_sql_database_worker_maintenance_job_long_running_total{namespace=~\"$namespace\"})",
2921+
"expr": "max(promscale_sql_database_worker_maintenance_job_long_running{namespace=~\"$namespace\"})",
29222922
"interval": "",
29232923
"legendFormat": "total",
29242924
"range": true,
@@ -3094,7 +3094,7 @@
30943094
},
30953095
"editorMode": "code",
30963096
"exemplar": false,
3097-
"expr": "max(promscale_sql_database_worker_maintenance_job_locks_total{namespace=~\"$namespace\"})",
3097+
"expr": "max(promscale_sql_database_worker_maintenance_job_locks{namespace=~\"$namespace\"})",
30983098
"interval": "",
30993099
"legendFormat": "total",
31003100
"range": true,

pkg/pgmodel/metrics/database/metrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ var metrics = []metricQueryWrap{
249249
prometheus.GaugeOpts{
250250
Namespace: util.PromNamespace,
251251
Subsystem: "sql_database",
252-
Name: "worker_maintenance_job_locks_total",
252+
Name: "worker_maintenance_job_locks",
253253
Help: "Number of locks held by Promscale maintenance workers.",
254254
},
255255
),
@@ -326,7 +326,7 @@ var metrics = []metricQueryWrap{
326326
prometheus.GaugeOpts{
327327
Namespace: util.PromNamespace,
328328
Subsystem: "sql_database",
329-
Name: "worker_maintenance_job_long_running_total",
329+
Name: "worker_maintenance_job_long_running",
330330
Help: "Number of Promscale maintenance workers executing long running queries.",
331331
},
332332
),

0 commit comments

Comments
 (0)