Available on crate feature
prometheus_protobuf only.Expand description
Prometheus protobuf implementation.
// Returns `Vec<MetricFamily>`, the top-level container type. Please refer to [metrics.proto](https://github.com/prometheus/prometheus/blob/main/prompb/io/prometheus/client/metrics.proto) for details.
let metric_families = encode(®istry).unwrap();
let family = metric_families.first().unwrap();
assert_eq!("my_counter_total", family.name);
assert_eq!("This is my counter.", family.help);For wire-format exposition, serialize each returned MetricFamily with
length-delimited protobuf framing. encode_to_vec provides the exact
payload used with
application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited.
Modules§
- prometheus_
data_ model - Data models generated from Prometheus
io.prometheus.clientprotobuf.
Enums§
- Encode
Error - Errors returned by
encode_to_vec.
Functions§
- encode
- Encode the metrics registered with the provided
Registryinto PrometheusMetricFamilymessages. - encode_
to_ vec - Encode the metrics registered with the provided
Registryinto a length-delimited Prometheus protobuf payload.