-
Notifications
You must be signed in to change notification settings - Fork 7
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
Feature plans #3
Comments
But this tool can already be used in linting metrics names. For example, I did a test for Cortex. promlinter .
cortex_cache_fetched_keys: counter metrics should have "_total" suffix
cortex_cache_hits: counter metrics should have "_total" suffix
cortex_purger_pending_delete_requests_count: non-histogram and non-summary metrics should not have "_count" suffix
cortex_ingester_received_chunks: counter metrics should have "_total" suffix
cortex_ingester_received_files: counter metrics should have "_total" suffix
cortex_ingester_sent_chunks: counter metrics should have "_total" suffix
cortex_ingester_sent_files: counter metrics should have "_total" suffix
memberlist_client_watch_prefix_dropped_notifications: counter metrics should have "_total" suffix
cortex_ruler_managers_total: non-counter metrics should not have "_total" suffix |
Step 3 and 4 is done. |
Is checking that metrics are actually registered supported? |
Hello, it is not supported and I haven't think of it. It would be complicated because there are a lot of patterns to register metrics. It would be great if you could share some ideas! |
That's also why it is sometimes forgotten :) |
Just quickly try this, I would like to highlight some issues i have right now, keen to hear your thought.
|
@sayboras Hey, thanks for the feedback. That's a problem for me as well. It is common to use const values from other packages like TBH, I am quite new to golang static linting and I don't know how to get the const or var values from other packages. It would be good if you could help or give some ideas. Thanks! |
But this linter should work well in most cases when defining metrics using string literals. Like the metrics in the testcase https://github.com/yeya24/promlinter/blob/master/testdata/testdata.go |
Now this linter can work, but it is not good. It only has some very basic features.
What it cannot support:
var
,const
, or from other packages.Getting metrics information from
prometheus.Desc
, it is doable, but we need to parsech <- prometheus.MustNewConstMetric
as well, otherwise we cannot get the correct metric type.Support outputting the position (filename, column and row) of the bad metric
The text was updated successfully, but these errors were encountered: