Skip to content

Commit

Permalink
chore: don't query prometheus if disabled (#1369)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
NathanFlurry committed Nov 18, 2024
1 parent 4dd3324 commit e0d2b98
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/services/cluster/src/ops/datacenter/topology_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ pub async fn cluster_datacenter_topology_get(
None
},
Some,
);
)
.flatten();

Ok((hardware_specs, prometheus_metrics))
},
Expand Down Expand Up @@ -436,7 +437,12 @@ async fn fetch_server_metrics(
config: &rivet_config::Config,
servers: &[&ServerRowStructured],
hardware_specs: &HashMap<String, ServerSpec>,
) -> GlobalResult<HashMap<Uuid, Stats>> {
) -> GlobalResult<Option<HashMap<Uuid, Stats>>> {
if config.server()?.prometheus.is_none() {
tracing::debug!("prometheus disabled");
return Ok(None);
};

let prom_res = handle_request(
&config.server()?.prometheus()?.url.to_string(),
formatdoc!(
Expand Down Expand Up @@ -554,7 +560,7 @@ async fn fetch_server_metrics(
}
}

Ok(stats_by_server_id)
Ok(Some(stats_by_server_id))
}

#[derive(Debug, Deserialize)]
Expand Down

0 comments on commit e0d2b98

Please sign in to comment.