Skip to content

Relax metric name validation in Dropwizard5 CustomMappingSampleBuilder#1985

Open
LiamClarkeNZ wants to merge 1 commit intoprometheus:mainfrom
LiamClarkeNZ:fix/relax-dropwizard5-metric-name-validation
Open

Relax metric name validation in Dropwizard5 CustomMappingSampleBuilder#1985
LiamClarkeNZ wants to merge 1 commit intoprometheus:mainfrom
LiamClarkeNZ:fix/relax-dropwizard5-metric-name-validation

Conversation

@LiamClarkeNZ
Copy link

@LiamClarkeNZ LiamClarkeNZ commented Mar 25, 2026

Decided to revisit a very old PR of mine that addressed an issue that seems to reoccur periodically for others.

Changes

  • Relaxes overly strict METRIC_GLOB_REGEX in MapperConfig/GraphiteNamePattern to accept a broader range of metric name patterns
  • The CustomMappingSampleBuilder can now remap metrics with underscores, colons, hyphens, and single-level names
  • Still rejects clearly invalid inputs (empty strings, double-star globs, trailing/double dots)

Fixes

The validation was originally designed for Graphite bridge metrics but is too restrictive for CustomMappingSampleBuilder which needs to handle arbitrary Dropwizard metric names.

@fstab @dhoard @zeitlinger @jaydeluca when you have a chance would appreciate your review :)

@LiamClarkeNZ LiamClarkeNZ marked this pull request as draft March 25, 2026 02:14
The MapperConfig and GraphiteNamePattern classes enforced Graphite-style
dot-separated naming conventions on input metrics, preventing the
CustomMappingSampleBuilder from remapping metrics with underscores,
colons, or single-level names.

Relaxes the validation regex to accept a broader range of metric name
patterns while still rejecting clearly invalid inputs.

Fixes prometheus#461, prometheus#518, prometheus#645

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Liam Clarke-Hutchinson <liam@steelsky.co.nz>
@LiamClarkeNZ LiamClarkeNZ force-pushed the fix/relax-dropwizard5-metric-name-validation branch from 0c81193 to 6746915 Compare March 25, 2026 02:18
@LiamClarkeNZ LiamClarkeNZ marked this pull request as ready for review March 25, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant