Status: Experimental (Work in Progress)
Official Rust libraries for Prometheus and OpenMetrics metric collection pipelines: wire exposition format decoding (expfmt), target and metric relabeling, standard service discoveries, and scrape management.
scrape.rs provides the building blocks required to discover targets, relabel labels, scrape HTTP endpoints, and decode Prometheus and OpenMetrics payloads in Rust:
Service discoveries
-> Target relabeling
-> Scrape manager / HTTP fetch
-> Streaming expfmt parser
-> Metric relabeling / drop hook
-> Columnar Apache Arrow (OTAP) batches or Protobuf DTOs
The project serves two main use cases:
- Columnar scraping for OpenTelemetry Arrow.
open-telemetry/otel-arrow#3277defines an OTAP-nativeprometheus_scrapereceiver in Rust.scrape.rsstreams scrape bytes through pre-allocation relabeling and metric family assembly directly into Apache Arrow (OtapArrowRecords) tables on thread-per-core!Sendruntimes with bounded memory. - Standalone Rust Prometheus tooling. Validation harnesses such as OpenTelemetry Weaver live-checking
/metricsendpoints against semantic conventions, CLIs, and custom collectors can use individual components (such asexpfmtDTO decoding orrelabel) without pulling in the full scrape runtime.
| Component | Status | Specification | Scope |
|---|---|---|---|
expfmt |
In progress | specs/expfmt/SPEC.md | Content-Type and Accept negotiation, zero-copy streaming parsers for Prometheus Text 0.0.4, OpenMetrics 1.0, OpenMetrics 2.0, and Prometheus Protobuf, primary Apache Arrow / OTAP decoder (ArrowDecoder), and MetricFamily protobuf DTO decoder. |
relabel |
Planned | TBD | Prometheus-compatible target and metric relabeling (replace, keep, drop, hashmod, labelmap, labeldrop, labelkeep, lowercase, uppercase, keepequal, dropequal), including pre-allocation filtering on borrowed parser label buffers. |
discovery |
Planned | TBD | Standard Prometheus service discovery mechanisms (static targets, file-based SD, HTTP SD, DNS SD, Kubernetes SD) emitting target groups and __meta_* labels. |
scrape |
Planned | TBD | Bounded HTTP scrape scheduling, target pool lifecycle, compression and content negotiation, stale marker handling, target state reporting, and self-telemetry. |
Run the unit and fixture test suite:
cargo test --all-featuresRun the otel-arrow-dfe-pdata compatibility test suite:
cargo test --manifest-path tests/otap-compat/Cargo.tomlRun the Go differential fixture extractor and tests (requires Go):
cd tests/go-harness && go test ./...Run the Criterion decoding benchmarks:
cargo bench --bench decode