fix: Relax metric name validation in Dropwizard5#1985
Merged
zeitlinger merged 2 commits intoprometheus:mainfrom Mar 30, 2026
Merged
Conversation
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 <[email protected]> Signed-off-by: Liam Clarke-Hutchinson <[email protected]>
0c81193 to
6746915
Compare
jaydeluca
approved these changes
Mar 29, 2026
Collaborator
jaydeluca
left a comment
There was a problem hiding this comment.
knocking out 3 issues in one PR, going for the hat-trick! 😄
just one small nitpick comment but otherwise LGTM
Co-authored-by: Jay DeLuca <[email protected]> Signed-off-by: Liam Clarke-Hutchinson <[email protected]>
zeitlinger
pushed a commit
that referenced
this pull request
Apr 27, 2026
🤖 I have created a release *beep* *boop* --- ## [1.6.0](v1.5.1...v1.6.0) (2026-04-25) ### Features * Add logic for handling content negotation flag with OM2 ([#1986](#1986)) ([0fa1ad7](0fa1ad7)) * Add OM2 native histogram text output ([#2042](#2042)) ([dec8e5b](dec8e5b)) * add OTel preserve_names for scrape-time suffix handling ([#1956](#1956)) ([f794288](f794288)) * compositeValues and exemplarCompliance flags for OM2 writer ([#1991](#1991)) ([ff48ae8](ff48ae8)) * move suffix handling to scrape time ([#1955](#1955)) ([5a5106c](5a5106c)) * OM2 writer outputs names as provided, no suffix appending ([#1957](#1957)) ([5ce2b57](5ce2b57)) ### Bug Fixes * **deps:** update dependency com.google.guava:guava to v33.6.0-jre ([#2021](#2021)) ([1382693](1382693)) * **deps:** update dependency commons-io:commons-io to v2.22.0 ([#2044](#2044)) ([9e05c1d](9e05c1d)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.27.0-alpha ([#2022](#2022)) ([30ac534](30ac534)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.27.0-alpha ([#2023](#2023)) ([2d51a32](2d51a32)) * **deps:** update dependency io.prometheus:prometheus-metrics-bom to v1.5.1 ([#2004](#2004)) ([650ce4b](650ce4b)) * **deps:** update dependency org.apache.tomcat.embed:tomcat-embed-core to v11.0.21 ([#2005](#2005)) ([7a36df7](7a36df7)) * **deps:** update dependency org.springframework.boot:spring-boot-starter-parent to v4.0.5 ([#2006](#2006)) ([0106c18](0106c18)) * **deps:** update dependency org.springframework.boot:spring-boot-starter-parent to v4.0.6 ([#2046](#2046)) ([40a9db8](40a9db8)) * **deps:** update jetty monorepo to v12.1.8 ([#2007](#2007)) ([acab5b2](acab5b2)) * **deps:** update protobuf ([#2024](#2024)) ([8e2214e](8e2214e)) * pass release tag as input to deploy workflow ([#1982](#1982)) ([165c921](165c921)) * pin grafana/otel-lgtm to 0.7.2 in OATs acceptance test ([#1992](#1992)) ([f17ad9a](f17ad9a)) * Relax metric name validation in Dropwizard5 ([#1985](#1985)) ([deb782f](deb782f)) * stabilize flaky timer and thread count tests ([#1973](#1973)) ([ce5867b](ce5867b)) * Tighten OM2 summary and start timestamp output ([#2041](#2041)) ([5699469](5699469)) * trigger Maven deploy from release-please via workflow_dispatch ([#1981](#1981)) ([698f956](698f956)) --- > [!IMPORTANT] > Close and reopen this PR to trigger CI checks. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Decided to revisit a very old PR of mine that addressed an issue that seems to reoccur periodically for others.
Changes
METRIC_GLOB_REGEXinMapperConfig/GraphiteNamePatternto accept a broader range of metric name patternsCustomMappingSampleBuildercan now remap metrics with underscores, colons, hyphens, and single-level namesFixes
:in regexThe validation was originally designed for Graphite bridge metrics but is too restrictive for
CustomMappingSampleBuilderwhich needs to handle arbitrary Dropwizard metric names.@fstab @dhoard @zeitlinger @jaydeluca when you have a chance would appreciate your review :)