[Testing] Add unit tests to verify Prometheus JMX template regexp patterns#18414
Merged
noob-se7en merged 3 commits intoapache:masterfrom May 8, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18414 +/- ##
============================================
+ Coverage 63.55% 63.64% +0.09%
- Complexity 1717 1735 +18
============================================
Files 3252 3254 +2
Lines 199051 199446 +395
Branches 30838 30977 +139
============================================
+ Hits 126503 126942 +439
+ Misses 62471 62365 -106
- Partials 10077 10139 +62
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
noob-se7en
reviewed
May 4, 2026
Contributor
noob-se7en
left a comment
There was a problem hiding this comment.
1 major test correctness.
…terns Adds PrometheusTemplateRegexpTest to validate the regexp patterns defined in the JMX exporter YAML config files under docker/images/pinot/etc/jmx_prometheus_javaagent/configs/. Tests include: - Parameterized validity check: all patterns in broker.yml, server.yml, controller.yml, minion.yml, and pinot.yml compile as valid Java regexps - Targeted correctness tests for key patterns (broker/server/controller/minion), verifying that expected JMX metric name strings match and that capture groups produce the expected table, tableType, database, taskType, and measurement labels Fixes apache#13588
Replace hardcoded inline pattern strings in targeted tests with calls to a new loadPattern(configFile, ruleIndex) helper that reads the pattern directly from the YAML file under test. This ensures tests always validate the live pattern — editing the YAML without updating the test will now surface a failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b95bb16 to
7e75603
Compare
Contributor
Author
|
@noob-se7en @xiangfu0 pleased help to review |
noob-se7en
reviewed
May 5, 2026
Contributor
noob-se7en
left a comment
There was a problem hiding this comment.
1 medium test robustness.
xiangfu0
approved these changes
May 7, 2026
Contributor
Author
|
@noob-se7en @xiangfu0 please merge |
Contributor
@Akanksha-kedia there is still 1 open comment, will request to address/reply to it before just marking it resolved. |
Replace loadPattern(file, index) with loadPatternByName(file, name), which finds the rule whose YAML `name` field matches (e.g. "pinot_$1_$6_$7"). Inserting or reordering a rule in the config files no longer silently shifts indices and causes tests to match a wrong rule. Addresses review comment from noob-se7en on apache#18414.
noob-se7en
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #13588
Adds
PrometheusTemplateRegexpTestto validate the regexp patterns defined in the JMX exporter YAML config files underdocker/images/pinot/etc/jmx_prometheus_javaagent/configs/.What the tests cover:
broker.yml,server.yml,controller.yml,minion.yml, andpinot.ymlcompile as valid Java regexps — catches syntax errors introduced when editing these filestable,tableType,database,taskType, measurement type)Test cases included:
pinot.broker.myTable_REALTIME.queriespinot.broker.myDb.myTable_OFFLINE.queriespinot.broker.myTable.queriespinot.broker.totalDocumentspinot.server.myTable_OFFLINE.segmentUploadFailurepinot.server.queries.myTable_REALTIME.3pinot.controller.numMinionTasksInProgress.SegmentGenerationAndPushpinot.controller.myTable_OFFLINE.segmentUploadFailurepinot.minion.myTable_REALTIME.SegmentGenerationAndPush.segmentUploadFailurepinot.minion.myTable.numberOfSegmentsQueuedTest plan
mvn -pl pinot-common test -Dtest=PrometheusTemplateRegexpTestpasses locally