-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[WIP] Test Cases for JMX -> Prom Exporter Regexps #14155
base: master
Are you sure you want to change the base?
[WIP] Test Cases for JMX -> Prom Exporter Regexps #14155
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #14155 +/- ##
=============================================
- Coverage 61.75% 34.41% -27.34%
- Complexity 207 739 +532
=============================================
Files 2436 2621 +185
Lines 133233 144074 +10841
Branches 20636 22041 +1405
=============================================
- Hits 82274 49585 -32689
- Misses 44911 90493 +45582
+ Partials 6048 3996 -2052
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the test!
Right now all tests are hard-coded and it won't be able to capture newly added metrics automatically. Instead, can we loop over the enums to ensure all the metrics are tested, which is also future proof?
Yes, that's the ideal way to do it. However, exported metric names are not standardised so it's not possible to derive it from the enum names (we should standardize them going forward). Further, metrics accept different kind of arguments for labelling. For example, some accept |
For this, I have added a check in each test case that basically asserts on the count of metrics exported. For any newly added metric, this check would fail. It's not fool-proof but does provide a basic check. Perhaps I can strengthen this further by adding a check that verifies that for each enum, we have an exported metric that contains the enum string in some form. |
Instructions:
This PR adds test cases to validate the regexps used to translate JMX metrics to Prom consumable format by the JMX->Prom exporter. Ref: https://github.com/prometheus/jmx_exporter.
The test case validates the following:
All meters/gauges/timers defined in
ServerMeter.java
,ServerGauge.java
orServerTimer.java
are exported. This gives use some level of confidence while adding any new metric to code, that it is being exported (we will still need to add a test case for asserting on the different labels, etc).Existing metrics have the right name and labels.
This is a WIP PR. I have raised it early to get some early feedback.