Skip to content

add c++ wrapper for prometheus & common metrics - #48430

Merged
jkarneges merged 1 commit into
mainfrom
jkarneges/prom-cpp
Sep 11, 2026
Merged

jkarneges merged 1 commit into
mainfrom
jkarneges/prom-cpp

Conversation

@jkarneges

Copy link
Copy Markdown
Member

Currently, StatsManager will construct an internally-owned PrometheusServer when prometheus metrics are enabled. This works as long as there is only one StatsManager instance in the whole process. However, the proxy component can be configured to have multiple workers, in which case multiple StatsManager instances will be created, one per worker. These configuration options are in conflict. It is not possible to enable multiple workers and prometheus metrics at the same time, since only one worker would be able to bind the configured port.

To make prometheus metrics work when there are multiple StatsManager instances, we need to rethink this. Either each instance needs to bind its own port, or multiple instances need to be able to share the same port. I think the latter approach is tidier, as it allows the worker count to be tuned without impacting scraper configurations.

Toward that end, this PR adds C++ wrappers around the prometheus and common metrics FFIs, to make it easy to construct these things outside of StatsManager. They are not used anywhere yet, but the plan is for applications to create one PrometheusServer and one CommonMetrics instance, and then share the CommonMetrics instance with one or more StatsManager instances.

@jkarneges
jkarneges requested a review from a team September 11, 2026 23:13
@jkarneges
jkarneges merged commit a2b172d into main Sep 11, 2026
21 checks passed
@jkarneges
jkarneges deleted the jkarneges/prom-cpp branch September 11, 2026 23:30
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