You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, promlinter is a metric name static linter based on the Prometheus metrics naming best practice. It was added to golangci-lint recently and I want to introduce it to Cortex.
As it is only a static linter, it can only detect partial metrics naming problems. But I still feel it useful to have it as part of CI.
From what I tried on the Cortex repo, it detects some metrics naming problems listed below:
pkg/chunk/cache/instrumented.go:39:46: Metric: cortex_cache_fetched_keys Error: counter metrics should have "_total" suffix (promlinter)
fetchedKeys: promauto.With(reg).NewCounter(prometheus.CounterOpts{
^
pkg/chunk/cache/instrumented.go:46:39: Metric: cortex_cache_hits Error: counter metrics should have "_total" suffix (promlinter)
hits: promauto.With(reg).NewCounter(prometheus.CounterOpts{
^
pkg/compactor/blocks_cleaner.go:101:48: Metric: cortex_bucket_blocks_count Error: non-histogram and non-summary metrics should not have "_count" suffix (promlinter)
tenantBlocks: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{
^
pkg/compactor/blocks_cleaner.go:105:54: Metric: cortex_bucket_blocks_marked_for_deletion_count Error: non-histogram and non-summary metrics should not have "_count" suffix (promlinter)
tenantMarkedBlocks: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{
^
pkg/compactor/blocks_cleaner.go:109:55: Metric: cortex_bucket_blocks_partials_count Error: non-histogram and non-summary metrics should not have "_count" suffix (promlinter)
tenantPartialBlocks: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{
^
pkg/ruler/manager.go:69:46: Metric: cortex_ruler_managers_total Error: non-counter metrics should not have "_total" suffix (promlinter)
managersTotal: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
^
pkg/ingester/metrics.go:162:43: Metric: cortex_ingester_sent_chunks Error: counter metrics should have "_total" suffix (promlinter)
sentChunks: promauto.With(r).NewCounter(prometheus.CounterOpts{
^
pkg/ingester/metrics.go:166:47: Metric: cortex_ingester_received_chunks Error: counter metrics should have "_total" suffix (promlinter)
receivedChunks: promauto.With(r).NewCounter(prometheus.CounterOpts{
^
pkg/chunk/purger/purger.go:74:59: Metric: cortex_purger_pending_delete_requests_count Error: non-histogram and non-summary metrics should not have "_count" suffix (promlinter)
m.pendingDeleteRequestsCount = promauto.With(r).NewGauge(prometheus.GaugeOpts{
Please let me know what should I do to these metrics, whether I should rename them or not. If I need to rename them, what else should I do? (Like rename these metrics in the Grafana dashboards as well) Thanks!
The text was updated successfully, but these errors were encountered:
Thanks @yeya24 for raising this! Renaming metrics, despite correct, tends to be a bit annoying for Cortex users cause this will have an impact on dashboards and alerts. My suggestion is to add the linter and a lint ignore comment for these cases, so that at least we'll be covered for new metrics we'll add.
This issue has been automatically marked as stale because it has not had any activity in the past 60 days. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.
Hi, promlinter is a metric name static linter based on the Prometheus metrics naming best practice. It was added to
golangci-lint
recently and I want to introduce it to Cortex.As it is only a static linter, it can only detect partial metrics naming problems. But I still feel it useful to have it as part of CI.
From what I tried on the Cortex repo, it detects some metrics naming problems listed below:
Please let me know what should I do to these metrics, whether I should rename them or not. If I need to rename them, what else should I do? (Like rename these metrics in the Grafana dashboards as well) Thanks!
The text was updated successfully, but these errors were encountered: