1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Wire format encoders.
//!
//! This module groups all metric exposition backends used by FastMetrics.
//!
//! ## Availability
//!
//! - [`text`] is always available.
//! - [`prost`] is available with feature `prost`.
//! - [`protobuf`] is available with feature `protobuf`.
//!
//! ## Text format
//!
//! The [`text`] module exposes the API:
//! - `encode(buffer, registry, profile)`
//! - `encode_with(buffer, registry, profile, enter_scope)`.
//!
//! Text profiles:
//! - `PrometheusV0_0_4`: [Prometheus text format]
//! - `PrometheusV1_0_0`: [Prometheus text format] + escaping scheme support
//! - `OpenMetricsV0_0_1`: [OpenMetrics text format]
//! - `OpenMetricsV1_0_0` (default): [OpenMetrics text format] + escaping scheme support
//!
//! ## Protobuf format
//!
//! Protobuf support is feature-gated and provided by two interchangeable backends:
//! - [`prost`] (feature `prost`)
//! - [`protobuf`] (feature `protobuf`)
//!
//! Both backends expose the same API shape:
//! - `encode(buffer, registry, profile)`
//! - `encode_with(buffer, registry, profile, enter_scope)`
//!
//! Protobuf profiles:
//! - `Prometheus` (default): length-delimited `io.prometheus.client.MetricFamily` stream
//! - [Prometheus protobuf format]
//! - [Prometheus protobuf schema]
//! - `OpenMetrics1`: single `openmetrics.MetricSet` message
//! - [OpenMetrics protobuf format]
//! - [OpenMetrics protobuf schema]
//!
//! [OpenMetrics text format]: https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.md#text-format
//! [Prometheus text format]: https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-details
//! [OpenMetrics protobuf format]: https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.md#protobuf-format
//! [OpenMetrics protobuf schema]: https://github.com/prometheus/OpenMetrics/blob/main/proto/openmetrics_data_model.proto
//! [Prometheus protobuf format]: https://prometheus.io/docs/instrumenting/exposition_formats/#protobuf-format
//! [Prometheus protobuf schema]: https://github.com/prometheus/client_model/blob/master/io/prometheus/client/metrics.proto