Skip to content

statsmanager: use rust-based prometheus implementation - #48426

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

statsmanager: use rust-based prometheus implementation#48426
jkarneges merged 1 commit into
mainfrom
jkarneges/statsmanager-rust-prom

Conversation

@jkarneges

@jkarneges jkarneges commented Sep 10, 2026

Copy link
Copy Markdown
Member

This replaces the C++ Prometheus server code in StatsManager with calls to the Rust-based Prometheus implementation via FFI.

The changes are fairly straightforward:

  • If Prometheus metrics are enabled, instantiate Rust-based Prometheus server and common metrics instances.
  • Whenever combinedReport is updated, copy the values to the common metrics.

As a bonus, the event loop no longer needs to account for related I/O registrations (since the underlying PrometheusServer manages them in a dedicated thread) so that math is simplified.

Manually tested on Linux, to see the process metrics working alongside the common metrics:

# HELP connection_connected Number of concurrent connections
# TYPE connection_connected gauge
connection_connected 0
# HELP connection_minute Number of minutes clients have been connected
# TYPE connection_minute counter
connection_minute 0
# HELP message_received Number of messages received by the publish API
# TYPE message_received counter
message_received 1
# HELP message_sent Number of messages sent to clients
# TYPE message_sent counter
message_sent 0
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1024
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 55
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 20639744
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1789083449
# HELP process_threads Number of OS threads in the process.
# TYPE process_threads gauge
process_threads 4
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 232411136
# HELP request_received Number of requests received
# TYPE request_received counter
request_received 0

@jkarneges
jkarneges requested a review from a team September 11, 2026 00:05
@jkarneges
jkarneges merged commit 151db25 into main Sep 11, 2026
21 checks passed
@jkarneges
jkarneges deleted the jkarneges/statsmanager-rust-prom branch September 11, 2026 00:48
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