Skip to content

allow prometheus prefixes to override component names - #48434

Merged
jkarneges merged 1 commit into
mainfrom
jkarneges/prom-prefixes
Sep 14, 2026
Merged

jkarneges merged 1 commit into
mainfrom
jkarneges/prom-prefixes

Conversation

@jkarneges

@jkarneges jkarneges commented Sep 14, 2026

Copy link
Copy Markdown
Member

This arranges the default prefixes for each component as such:

  • connmgr - default prefix is connmgr
  • proxy - default prefix is proxy
  • handler - no default prefix set, for compatibility (we can consider setting to handler in 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::Registry inserts an underscore automatically, so trailing underscores in the input are ignored. This means a user can set a prefix as foo or foo_ and either way the metrics will be named foo_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=foo in pushpin.conf, a metric named metric_name will have its name resolved as foometric_name. Going forward, the name will be resolved as foo_metric_name. Technically this a breaking change, but since the magic underscore behavior from the prometheus crate 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 form prometheus_prefix=foo_), and since it's not critical path, I think we can consider such breakage acceptable for a 1.x release.

@jkarneges
jkarneges requested a review from a team September 14, 2026 18:50
@jkarneges
jkarneges merged commit fd4b78a into main Sep 14, 2026
21 checks passed
@jkarneges
jkarneges deleted the jkarneges/prom-prefixes branch September 14, 2026 20:26
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.

2 participants