prometheus

Prometheus instrumentation library for Rust applications, ported from the official Go client

Library
Cargo
v0.14.0
1,180stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity4
Maintenance0
Community84
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture76
Code Quality78
Innovation60
Learning Curve72

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 *Vec variants, matching the Go client’s API shape closely
  • A Registry type for collecting and exposing all registered metrics together
  • Text and protobuf encoders for exposing metrics at a scrape endpoint (protobuf feature enabled by default)
  • Optional process feature for standard process metrics (CPU, memory, file descriptors) on Linux via procfs
  • Optional push feature for pushing metrics to a Prometheus Pushgateway
  • Companion prometheus-static-metric crate (in static-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 /metrics endpoint 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 (push feature)

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

Go
32%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

11,247

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.

View details
83
Repo Health
88
Technical
63
Dependency
Built with
Go32%
Rust31%
C21%
Updated today
Python
80%
Apache 2.0

headroom

AI Development · Developer Tools

66,835

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.

View details
84
Repo Health
86
Technical
73
Dependency
Built with
Python80%
Rust14%
Updated today
Rust
96%
Apache 2.0

InfluxDB

Databases · Analytics

31,705

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
86
Repo Health
76
Technical
72
Dependency
Built with
Rust96%
Updated yesterday
Rust
78%
AGPL 3.0

Lemmy

Community · Social Media

14,555

Federated, self-hosted Reddit alternative with full community ownership and no corporate control.

View details
90
Repo Health
74
Technical
63
Dependency
Built with
Rust78%
PLpgSQL14%
Updated yesterday
Rust
100%
Other

Meilisearch

Search

59,012

Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.

View details
90
Repo Health
88
Technical
68
Dependency
Built with
Rust100%
Updated 5 days ago
Rust
89%
Apache 2.0

Qdrant

Databases · AI Development · Search

34,058

Open-source vector database and search engine built in Rust for production-grade AI applications — from semantic search to RAG pipelines and recommendation systems.

View details
92
Repo Health
87
Technical
69
Dependency
Built with
Rust89%
Updated yesterday
Rust
98%

Stalwart

Collaboration

14,255

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
89
Repo Health
81
Technical
68
Dependency
Built with
Rust98%
Updated yesterday
Rust
71%
MIT

Trieve

AI Development · Search · Developer Tools

2,715

All-in-one self-hostable platform for hybrid search, RAG, recommendations, and analytics built on Rust and Qdrant.

View details
43
Repo Health
74
Technical
66
Dependency
Built with
Rust71%
Updated 6 months ago
Rust
97%
Other

Zed

Developer Tools · Collaboration · Code Editors

88,861

High-performance, multiplayer code editor built in Rust by the creators of Atom and Tree-sitter, with native AI integration and real-time collaboration.

View details
94
Repo Health
88
Technical
73
Dependency
Built with
Rust97%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search