Skip to content

Commit

Permalink
Put service metrics behind a feature (#3988)
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-mobilecoin committed May 14, 2024
1 parent 042bf88 commit af06be3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion util/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rust-version = { workspace = true }
[dependencies]
mc-common = { path = "../../common", features = ["loggers"] }
mc-util-build-info = { path = "../build/info" }
mc-util-metrics = { path = "../metrics" }
mc-util-metrics = { path = "../metrics", features = ["service_metrics"] }
mc-util-serial = { path = "../serial", features = ["std"] }
mc-util-uri = { path = "../uri" }

Expand Down
6 changes: 5 additions & 1 deletion util/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ edition = "2021"
license = "GPL-3.0"
rust-version = { workspace = true }

[features]
default = []
service_metrics = ["dep:grpcio"]

[dependencies]
mc-common = { path = "../../common", features = ["log"] }

chrono = "0.4"
grpcio = "0.13"
grpcio = { version = "0.13", optional = true }
lazy_static = "1.4"
prometheus = "0.13"
protobuf = "2.27.1"
Expand Down
2 changes: 2 additions & 0 deletions util/metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub use serde_json::json;
// ------------------------------------
mod json_encoder;
mod op_counters;
#[cfg(feature = "service_metrics")]
mod service_metrics;

pub use json_encoder::JsonEncoder as MetricsJsonEncoder;
Expand All @@ -19,4 +20,5 @@ pub use prometheus::{
register, register_histogram, Histogram, HistogramOpts, HistogramVec, IntCounter,
IntCounterVec, IntGauge, IntGaugeVec, Opts,
};
#[cfg(feature = "service_metrics")]
pub use service_metrics::{GrpcMethodName, ServiceMetrics};

0 comments on commit af06be3

Please sign in to comment.