NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #1447 most downloaded on crates.io
Open Metrics client library allowing users to natively instrument applications.
Last release 1 months ago
01 Sep 2026
Ships fairly regularly
a new release about every 3 months
Nearly every release is documented
notes for 21 of 22 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
24 releases · first in 2022
One column per quarter.
The EncodeLabelSet and EncodeLabelValue derive macros now emit spanned compile errors for invalid input instead of panicking, so diagnostics point at
EncodeLabelSet and EncodeLabelValue derive macros now emit spanned compile errors for invalid input instead of panicking, so diagnostics point at the offending type or attribute rather than at the derive site. See PR 307.prometheus-client-derive-encode to v0.5.1, which updates its syn dependency to v3.The protobuf and openmetrics_protobuf features retain the now- deprecated OpenMetrics protobuf support, which will be removed in a future release.
protobuf-protox feature to build protobuf support without requiring an external protoc binary.prometheus_protobuf now generates and encodes Prometheus io.prometheus.client protobuf messages (from metrics.proto) instead of the OpenMetrics protobuf data model (prometheus/OpenMetrics/issues/296). The protobuf and openmetrics_protobuf features retain the now-deprecated OpenMetrics protobuf support, which will be removed in a future release.prost, prost-build, and prost-types to v0.14.Full Changelog: v0.24.1...v0.25.0
Added native histogram support, including native-only histograms and histograms with both classic and native buckets.
Added an off-by-default protobuf-protox feature to build protobuf support
without requiring an external protoc binary.
prost, prost-build, and prost-types dependencies to v0.14.prometheus_protobuf feature generates and encodes Prometheus
io.prometheus.client protobuf messages from metrics.proto rather than the
OpenMetrics protobuf data model.
See Issue for more context.
The protobuf and openmetrics_protobuf features retain the old, deprecated, OpenMetrics protobuf support which will
be removed in a future release.refactor(encoding): remove as casts by @jalil-salame in #281
as casts by @jalil-salame in #281count() and sum() accessors by @cratelyn in #242contains() checks if metrics exist by @cratelyn in #245len() returns the number of metrics by @cratelyn in #246Full Changelog: v0.23.1...v0.24.1
EncodeGaugeValue is implemented for usize and isize, and
EncodeCounterValue is implemented for usize. See PR 282.EncodeGaugeValue, EncodeCounterValue and EncodeExemplarValue now use
fewer as casts in their implementation. This caught an issue where
EncodeGaugeValue would not error when encoding some u64s that don't fit
in a i64. See PR 281.Histogram now exposes count() and sum() methods when the test-util
feature is enabled. See PR 242.Family now exposes a contains() method when the test-util feature
is enabled. See PR 245.Family now exposes len() and is_empty() methods when the
test-util feature is enabled. See PR 246.feat(encoding)!: EncodeLabelSet::encode() uses reference by @cratelyn in #257
EncodeLabelSet::encode() uses reference by @cratelyn in #257Family::get_or_create_owned() by @cratelyn in #244Full Changelog: v0.23.1...v0.24.0
EncodeLabelSet is now implemented for tuples (A: EncodeLabelSet, B: EncodeLabelSet).
See PR 257.
Family::get_or_create_owned can access a metric in a labeled family. This
method avoids the risk of runtime deadlocks at the expense of creating an
owned type. See PR 244.
impl<T: Collector> Collector for std::sync::Arc<T>.
See PR 273.
EncodeLabelSet::encode() now accepts a mutable reference to its encoder parameter.convert_classic_histograms_to_nhcb: true
in Prometheus scraping. See PR 276.See changelog for details.
See changelog for details.
Histogram::new now accepts an IntoIterator argument, rather than an Iterator.
See PR 243.See changelog for details.
See changelog for details.
ConstCounter::new now requires specifying the type of literal arguments, like this: ConstCounter::new(42u64);.
See PR 173.
Update prost dependencies to v0.12.
See PR 198.
Implement Atomic<u64> for AtomicU64 for gauges.
See PR 226.
Implement EnableLabelValue for bool.
See PR 237
Support i32/f32 for Gauge and u32/f32 for Counter/CounterWithExemplar.
See PR 173 and PR 216.
Supoort Arc<String> for EncodeLabelValue.
See PR 217.
Add histogram::exponential_buckets_range.
See PR 233.
Added get method to Family.
See PR 234.
, when encoding empty family label set.
See PR 175.See changelog for details.
See changelog for details.
See changelog for details.
See changelog for details.
See changelog for details.
EncodeLabelValue and EncodeLabelKey implementations for Arc,
Rc, and Box.
See PR 188.See changelog for details.
See changelog for details.
Collector trait by enabling Collector::collect to encode metrics directly with a DescriptorEncoder.
See PR 149 for details.Added sub_registry_with_labels method to Registry. See [PR 145].
Implement EncodeLabelValue for Option . See [PR 137].
EncodeLabelValue for Option<T>.
See PR 137.Replace impl EncodeMetric for RefCell with a new type ConstFamily implementing EncodeMetric.
impl EncodeMetric for RefCell<T> with a new type ConstFamily implementing EncodeMetric.Introduce Collector abstraction allowing users to provide additional metrics and their description on each scrape. See [PR 82].
Introduce Collector abstraction allowing users to provide additional metrics
and their description on each scrape. See PR 82.
Introduce a #[prometheus(flatten)] attribute which can be used when deriving EncodeLabelSet, allowing
a nested struct to be flattened during encoding. See PR 118.
For example:
#[derive(EncodeLabelSet, Hash, Clone, Eq, PartialEq, Debug)]
struct CommonLabels {
a: u64,
b: u64,
}
#[derive(EncodeLabelSet, Hash, Clone, Eq, PartialEq, Debug)]
struct Labels {
unique: u64,
#[prometheus(flatten)]
common: CommonLabels,
}
Would be encoded as:
my_metric{a="42",b="42",unique="42"} 42
This is a large release including multiple breaking changes. Major user-facing improvement of this release is support for the OpenMetrics Protobuf for…
This is a large release including multiple breaking changes. Major user-facing improvement of this release is support for the OpenMetrics Protobuf format.
Don't box before registering.
registry.register(
"my_metric",
"This is my metric",
- Box::new(my_metric.clone()),
+ my_metric.clone(),
);
Gauge uses i64 instead of u64.
my_gauge
- .set(42u64);
+ .set(42i64);
Derive EncodeLabelSet for struct and EncodeLabelValue for enum instead of just Encode for all and require Debug.
- #[derive(Clone, Hash, PartialEq, Eq, Encode)]
+ #[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug)]
struct Labels {
path: String,
method: Method,
some_number: u64,
}
- #[derive(Clone, Hash, PartialEq, Eq, Encode)]
+ #[derive(Clone, Hash, PartialEq, Eq, EncodeLabelValue, Debug)]
enum Method {
Get,
#[allow(dead_code)]
Put,
}
Encode as utf-8 and not as [u8].
- let mut buffer = vec![];
+ let mut buffer = String::new();
encode(&mut buffer, ®istry).unwrap();
For details on each of these, see changelog entries below.
remove method to Family to allow the removal of a specified label
set from a family. See PR 85.clear method to Family to allow the removal of all label sets
from a family. See PR 85.TypedMetric for CounterWithExemplar and HistogramWithExemplar, so that they can be used with Family. See PR 96.Registry, i.e. remove generic type parameter M from Registry. See PR 105.EncodeCounterValue)EncodeLabelSet), derivable for structs via prometheus-client-derive-encodeEncodeLabel)EncodeLabelKey)EncodeLabelValue), derivable for enums via prometheus-client-derive-encodestd::fmt::Write instead of std::io::Write.Gauge for compliance with OpenMetrics protobuf
format. See PR 105.Nothing published for this version
Nothing published for this version
Fix race condition in Family::get_or_create. See [PR 102].
Family::get_or_create. See PR 102.Use parking_lot instead of std::*.
Use parking_lot instead of std::sync::*.
Before proemtheus-client would use the owning_ref crate to map the target
of a std::sync::RwLockReadGuard. owning_ref has multiple unsoundness
issues, see https://rustsec.org/advisories/RUSTSEC-2022-0040.html. Instead of
replacing owning_ref with a similar crate, we switch to locking via
parking_lot which supports the above mapping natively.
Updates to Rust 2021 Edition. See [PR 65].
with_prefix method to Registry to allow initializing a registry with a prefix. See PR 70.Debug implementations on most public types that were missing them. See PR 71.Add trait implementation for a private type which lead to compile time conflicts with existing Add implementations e.g. on String. See PR 69.Require Registry default generic type SendEncodeMetric to be Sync. See [PR 58].
Registry default generic type SendEncodeMetric to be Sync. See PR 58.Expose Encoder methods. See [PR 41].
Release as prometheus-client and prometheus-client-derive-text-encode.
prometheus-client and prometheus-client-derive-text-encode.Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →