Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

promlint: Refine lintMetricTypeInName #1453

Closed
beorn7 opened this issue Feb 28, 2024 · 0 comments · Fixed by #1455
Closed

promlint: Refine lintMetricTypeInName #1453

beorn7 opened this issue Feb 28, 2024 · 0 comments · Fixed by #1455

Comments

@beorn7
Copy link
Member

beorn7 commented Feb 28, 2024

lintMetricTypeInName is very prone to false positives: The various metric types could all be used as normal words in metrics, where they aren't used at all to mark the metric type. A practical example raised in prometheus/prometheus#13660 is prometheus_target_scrapes_exceeded_native_histogram_bucket_limit_total. It counts how often the bucket limit was exceeded when scraping a native histogram. This metric isn't even a histogram, but promlint complains that the metric type is used as part of the metric name.

Which brings me to my proposal here: lintMetricTypeInName could simply only complain if the word used in the metric name coincides with the actual type of the metric. This will still allow false positives (medication_sold_over_the_counter_total as a contrived example for a counter), but it will at least exclude some of the false positives, and notably those that are false positives for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant