Open-Source Wikis

/

Pingora

/

Packages

/

pingora-prometheus

cloudflare/pingora

pingora-prometheus

Active contributors: ewang

Purpose

Prometheus metrics integration for Pingora. Provides a prometheus_http_service that exposes the standard /metrics endpoint as a Pingora Service, plus the small wiring needed to expose Pingora's built-in metrics.

The crate was split out of pingora-core on 2026-04-01 (commit 842ddd9) so users who don't want Prometheus aren't paying the dependency cost.

Directory layout

pingora-prometheus/src/
└── lib.rs              prometheus_http_service plus helpers

Key abstractions

Type File What it is
prometheus_http_service pingora-prometheus/src/lib.rs Function that builds a Pingora Service exposing /metrics

How it works

You call prometheus_http_service("prometheus_metrics", "0.0.0.0:9090") and add the resulting service to your Server. It listens on the given address and responds to /metrics with the default Prometheus registry's textual encoding.

To register custom metrics, use the prometheus crate's macros (register_counter!, register_histogram!, etc.) — they go to the global registry that prometheus_http_service reads from.

See docs/user_guide/prom.md for the full recipe.

Integration points

  • Independent crate; not transitively pulled in by pingora-core after the 2026-04 split.
  • Add it explicitly to your Cargo.toml if you want metrics.

Entry points for modification

  • Custom metric naming or filtering → keep your own registry and write a service that exposes it.
  • Adding a default metrics collector → add to this crate.

Key source files

File Purpose
pingora-prometheus/src/lib.rs The whole crate

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

pingora-prometheus – Pingora wiki | Factory