Skip to content

Commit

Permalink
fix: prom metrics no longer ping on --no-metrics (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu authored May 17, 2022
1 parent 4b15df5 commit 7f9c81a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions iroh-metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ pub fn init(cfg: Config) -> Result<(), Box<dyn std::error::Error>> {

/// Initialize the metrics subsystem.
pub fn init_metrics(cfg: Config) -> Result<(), Box<dyn std::error::Error>> {
let builder = PrometheusBuilder::new().with_push_gateway(
format!(
"{}/metrics/job/{}/instance/{}",
cfg.prometheus_gateway_endpoint, cfg.service_name, cfg.instance_id
),
Duration::from_secs(5),
)?;
builder.install()?;

if !cfg.debug {
let builder = PrometheusBuilder::new().with_push_gateway(
format!(
"{}/metrics/job/{}/instance/{}",
cfg.prometheus_gateway_endpoint, cfg.service_name, cfg.instance_id
),
Duration::from_secs(5),
)?;
builder.install()?;
}
Ok(())
}

Expand Down

0 comments on commit 7f9c81a

Please sign in to comment.