-
Notifications
You must be signed in to change notification settings - Fork 550
chore(lint): enable promlinter in golangci-lint #7063
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
base: main
Are you sure you want to change the base?
chore(lint): enable promlinter in golangci-lint #7063
Conversation
-enable promlinter in tools/linter/golangci-lint/.golangci.yml -add brief DEVELOP.md note about Prometheus metrics linting -no code changes required; CI will now report Prometheus metrics lint issues Signed-off-by: ADITYATIWARI342005 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7063 +/- ##
==========================================
- Coverage 71.02% 70.98% -0.04%
==========================================
Files 227 227
Lines 40465 40465
==========================================
- Hits 28741 28726 -15
- Misses 10021 10034 +13
- Partials 1703 1705 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add promlinter to enabled linters in .golangci.yml - Configure promlinter with strict: true - No code changes required; CI will now report Prometheus metrics lint issues Signed-off-by: ADITYATIWARI342005 <[email protected]>
Signed-off-by: ADITYA TIWARI <[email protected]>
thanks @ADITYATIWARI342005, is there a simple way to prove that this linter is actually useful by for e.g. editing these metric names https://github.com/envoyproxy/gateway/blob/main/internal/message/metrics.go and seeing if the linter catches it ? |
Signed-off-by: ADITYA TIWARI <[email protected]>
@ADITYATIWARI342005 can your edit the above suggested file to see if it still performs similarly? We are using wrappers so want to make sure it works |
Ok I will test the changes and inform you in some time. |
@arkodg
![]() Promlinter will catch issues if developers use direct Prometheus client calls. |
thanks for testing this out @ADITYATIWARI342005, I dont think there's value in adding this linter then because we've chosen to use internal libs to generate metrics |
What type of PR is this?
chore
: CI & build tools improvement - enables promlinter to catch common Prometheus client usage issuesWhat this PR does / why we need it:
This PR enables the promlinter in golangci-lint to catch common Prometheus client usage issues and improve code quality for metrics-related code.
Changes made:
tools/linter/golangci-lint/.golangci.yml
to add promlinter with minimal settings (strict: false
)Impact:
Files Changed:
tools/linter/golangci-lint/.golangci.yml
: Added promlinter configurationTesting:
Which issue(s) this PR fixes:
#7054
Closes #7054
Release Notes: No