prometheus
Prometheus instrumentation library for Rust applications, ported from the official Go client
Repository Health
Technical Analysis
rust-prometheus (published on crates.io as prometheus) is the Rust client library for instrumenting applications with Prometheus metrics. Its data structures and APIs are deliberately ported from the official Prometheus Go client (client_golang), giving Rust services the same Counter/Gauge/Histogram/Summary primitives, a Registry for collecting them, and both pull (/metrics scrape endpoint) and push-gateway export paths.
Maintained under the TiKV organization (the distributed key-value store behind TiDB), it’s a mature, widely used metrics library with over 127 million total downloads and a companion prometheus-static-metric crate for compile-time-optimized labeled metrics.
What You Get
- Counter, Gauge, Histogram, and their labeled
*Vecvariants, matching the Go client’s API shape closely - A
Registrytype for collecting and exposing all registered metrics together - Text and protobuf encoders for exposing metrics at a scrape endpoint (
protobuffeature enabled by default) - Optional
processfeature for standard process metrics (CPU, memory, file descriptors) on Linux via procfs - Optional
pushfeature for pushing metrics to a Prometheus Pushgateway - Companion
prometheus-static-metriccrate (instatic-metric/) that generates compile-time metric accessors for label sets known ahead of time, avoiding runtime label lookups
Common Use Cases
- Instrumenting a Rust web service or backend (as TiKV itself does) with request counters, latency histograms, and gauges
- Exposing a
/metricsendpoint for Prometheus to scrape from a long-running Rust daemon - Reducing per-request overhead of labeled metrics in hot paths via prometheus-static-metric’s compile-time-generated accessors
- Batch or short-lived job metrics reporting via the Pushgateway integration (
pushfeature)
Under The Hood
Architecture - The crate’s ~8,400-line src/ tree separates metric type implementations (counter.rs, gauge.rs, histogram.rs, vec.rs for labeled variants), the collection/description system (desc.rs, registry.rs, metrics.rs), export encoders (encoder/ for text and protobuf formats), and optional subsystems (process_collector.rs for OS-level metrics, push.rs for Pushgateway support); a companion crate under static-metric/ uses a proc-macro to generate strongly-typed accessors for labeled metric families known at compile time, sidestepping the hash-map lookup cost of the dynamic *Vec types. Tech Stack - Depends on protobuf (default, for the binary exposition format), parking_lot for fast locking, lazy_static, fnv/memchr for hashing/parsing, and optionally reqwest (push), procfs/libc (process metrics); edition 2018, Apache-2.0 licensed, benchmarked with criterion. Code Quality - The crate has a long production track record as TiKV’s own metrics layer (a widely deployed distributed database), with examples/ demonstrating registry setup and a CHANGELOG.md tracking releases back to early versions; however GitHub activity has been low recently (no commits since December 2025), so consumers should verify current maintenance cadence before depending on it for new features. API Design - The API intentionally mirrors the Go Prometheus client’s naming and shape (Counter, Gauge, Histogram, Registry, register()), which lowers the learning curve for teams already familiar with Prometheus instrumentation in other languages, at the cost of feeling less idiomatically Rust in places (e.g. macro-heavy vector/labeled-metric construction).
Used by 9 apps in this directory
CubeSandbox
Developer Tools · Security · AI Agents
Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.
headroom
AI Development · Developer Tools
Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.
InfluxDB
Databases · Analytics
Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.
Lemmy
Community · Social Media
Federated, self-hosted Reddit alternative with full community ownership and no corporate control.
Meilisearch
Search
Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.
Qdrant
Databases · AI Development · Search
Open-source vector database and search engine built in Rust for production-grade AI applications — from semantic search to RAG pipelines and recommendation systems.
Stalwart
Collaboration
All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.
Trieve
AI Development · Search · Developer Tools
All-in-one self-hostable platform for hybrid search, RAG, recommendations, and analytics built on Rust and Qdrant.
Zed
Developer Tools · Collaboration · Code Editors
High-performance, multiplayer code editor built in Rust by the creators of Atom and Tree-sitter, with native AI integration and real-time collaboration.