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

Commit

Permalink
Avoid using total suffix for gauge metrics and apply rate for counters
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
arajkumar committed Nov 17, 2022
1 parent 6974172 commit 6ec101f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
7 changes: 0 additions & 7 deletions docs/mixin/.lint
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,3 @@ exclusions:
template-datasource-rule:
target-counter-agg-rule:
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"
entries:
- dashboard: Promscale
panel: Long running maintenance queries by job type
- dashboard: Promscale
panel: Long running maintenance queries by wait event
- dashboard: Promscale
panel: Locks held by maintenance jobs by lock mode
6 changes: 3 additions & 3 deletions docs/mixin/dashboards/promscale.json
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "max(promscale_sql_database_worker_maintenance_job_long_running_total{namespace=~\"$namespace\"})",
"expr": "max(promscale_sql_database_worker_maintenance_job_long_running{namespace=~\"$namespace\"})",
"interval": "",
"legendFormat": "total",
"range": true,
Expand Down Expand Up @@ -2918,7 +2918,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "max(promscale_sql_database_worker_maintenance_job_long_running_total{namespace=~\"$namespace\"})",
"expr": "max(promscale_sql_database_worker_maintenance_job_long_running{namespace=~\"$namespace\"})",
"interval": "",
"legendFormat": "total",
"range": true,
Expand Down Expand Up @@ -3094,7 +3094,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "max(promscale_sql_database_worker_maintenance_job_locks_total{namespace=~\"$namespace\"})",
"expr": "max(promscale_sql_database_worker_maintenance_job_locks{namespace=~\"$namespace\"})",
"interval": "",
"legendFormat": "total",
"range": true,
Expand Down
4 changes: 2 additions & 2 deletions pkg/pgmodel/metrics/database/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ var metrics = []metricQueryWrap{
prometheus.GaugeOpts{
Namespace: util.PromNamespace,
Subsystem: "sql_database",
Name: "worker_maintenance_job_locks_total",
Name: "worker_maintenance_job_locks",
Help: "Number of locks held by Promscale maintenance workers.",
},
),
Expand Down Expand Up @@ -326,7 +326,7 @@ var metrics = []metricQueryWrap{
prometheus.GaugeOpts{
Namespace: util.PromNamespace,
Subsystem: "sql_database",
Name: "worker_maintenance_job_long_running_total",
Name: "worker_maintenance_job_long_running",
Help: "Number of Promscale maintenance workers executing long running queries.",
},
),
Expand Down

0 comments on commit 6ec101f

Please sign in to comment.