Skip to content

Commit

Permalink
spawn the server in torii
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Oct 19, 2024
1 parent fd3b89d commit 06df0d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bin/torii/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,8 @@ async fn main() -> anyhow::Result<()> {
if let Some(listen_addr) = args.metrics {
info!(target: LOG_TARGET, addr = %listen_addr, "Starting metrics endpoint.");
let prometheus_handle = PrometheusRecorder::install("torii")?;
dojo_metrics::Server::new(prometheus_handle)
.with_process_metrics()
.start(listen_addr)
.await?;
let server = dojo_metrics::Server::new(prometheus_handle).with_process_metrics();
tokio::spawn(server.start(listen_addr));

Check warning on line 302 in bin/torii/src/main.rs

View check run for this annotation

Codecov / codecov/patch

bin/torii/src/main.rs#L300-L302

Added lines #L300 - L302 were not covered by tests
}

let engine_handle = tokio::spawn(async move { engine.start().await });
Expand Down
2 changes: 2 additions & 0 deletions crates/metrics/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type BoxedHook = Box<dyn Hook<Output = ()>>;
type Hooks = Vec<BoxedHook>;

/// Server for serving metrics.
// TODO: allow configuring the server executor to allow cancelling on invidiual connection tasks.
// See, [hyper::server::server::Builder::executor]
pub struct Server<MetricsExporter> {
/// Hooks or callable functions for collecting metrics in the cases where
/// the metrics are not being collected in the main program flow.
Expand Down

0 comments on commit 06df0d0

Please sign in to comment.