Skip to content

Commit

Permalink
Properly handle metrics feature being disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn committed Oct 7, 2024
1 parent 1bf80d1 commit 4a379b9
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions iroh/src/node/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,26 +697,34 @@ where
let client = crate::client::Iroh::new(quic_rpc::RpcClient::new(controller.clone()));

let metrics_exporter_handle = if let Some(config) = self.metrics_push_config {
let PushMetricsConfig {
interval,
endpoint: gateway_endpoint,
service_name,
instance_name,
username,
password,
} = config;
let handle = tokio::spawn(async move {
iroh_metrics::service::exporter(
gateway_endpoint,
#[cfg(feature = "metrics")]
{
let PushMetricsConfig {
interval,
endpoint: gateway_endpoint,
service_name,
instance_name,
username,
password,
interval,
)
.await
});
Some(AbortOnDropHandle::new(handle))
} = config;
let handle = tokio::spawn(async move {
iroh_metrics::service::exporter(
gateway_endpoint,
service_name,
instance_name,
username,
password,
interval,
)
.await
});
Some(AbortOnDropHandle::new(handle))
}
#[cfg(not(feature = "metrics"))]
{
warn!("Metrics push configuration provided, but metrics feature is not enabled. Ignoring.");
None
}
} else {
None
};
Expand Down

0 comments on commit 4a379b9

Please sign in to comment.