Skip to content

Commit 01db2f9

Browse files
committed
Added support for the protobuf format for prometheus
this is a pre-req for #601, because native histograms are only supported with protobufs
1 parent f1914e8 commit 01db2f9

File tree

10 files changed

+777
-44
lines changed

10 files changed

+777
-44
lines changed

Cargo.lock

Lines changed: 103 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

metrics-exporter-prometheus/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ async-runtime = ["tokio", "hyper-util/tokio"]
2121
http-listener = ["async-runtime", "ipnet", "tracing", "_hyper-server"]
2222
uds-listener = ["http-listener"]
2323
push-gateway = ["async-runtime", "tracing", "_hyper-client"]
24+
protobuf = ["mime", "prost", "prost-types", "prost-build"]
2425
_hyper-server = ["http-body-util", "hyper/server", "hyper-util/server-auto"]
2526
_hyper-client = [
2627
"http-body-util",
@@ -52,12 +53,20 @@ thiserror = { workspace = true }
5253
tokio = { workspace = true, optional = true }
5354
tracing = { workspace = true, optional = true }
5455

56+
# Protobuf support
57+
mime = { version = "0.3", optional = true }
58+
prost = { workspace = true, optional = true }
59+
prost-types = { workspace = true, optional = true }
60+
5561
[dev-dependencies]
5662
proptest = { workspace = true }
5763
rand = { workspace = true }
5864
tracing = { workspace = true }
5965
tracing-subscriber = { workspace = true, features = ["fmt"] }
6066

67+
[build-dependencies]
68+
prost-build = { workspace = true, optional = true }
69+
6170
[[example]]
6271
name = "prometheus_push_gateway"
6372
required-features = ["push-gateway"]

metrics-exporter-prometheus/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn main() {
2+
#[cfg(feature = "protobuf")]
3+
{
4+
prost_build::compile_protos(&["proto/metrics.proto"], &["proto/"]).unwrap();
5+
}
6+
}

0 commit comments

Comments
 (0)