allow prometheus prefixes to override component names - #48434
Merged
Merged
Conversation
clintjedwards
approved these changes
Sep 14, 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.
This arranges the default prefixes for each component as such:
connmgrproxyhandlerin version 2).Notably, when defaults are present, the component name is part of the default, giving the user the ability to override the component name. This is mostly useful for connmgr which can be run as multiple instances. For example, a server-only instance could be given a prefix
pushpin_connmgr_in.Also, I should point out that the underlying
prometheus::Registryinserts an underscore automatically, so trailing underscores in the input are ignored. This means a user can set a prefix asfooorfoo_and either way the metrics will be namedfoo_metric_name. This was already the case for proxy/handler as of recent comments, and this PR makes connmgr behave the same consistency.One side-effect of handler having the above behavior is it is no longer possible to set a prefix without an underscore and expect it to be prepended without one. On the current stable version, if someone sets
prometheus_prefix=fooin pushpin.conf, a metric namedmetric_namewill have its name resolved asfoometric_name. Going forward, the name will be resolved asfoo_metric_name. Technically this a breaking change, but since the magic underscore behavior from theprometheuscrate is hard for us to avoid, and since excluding an underscore was never meant to be desirable and unlikely to be present in real world configurations (our docs suggest using the formprometheus_prefix=foo_), and since it's not critical path, I think we can consider such breakage acceptable for a 1.x release.