Skip to content

Commit

Permalink
Merge pull request #804 from saschagrunert/tracing-shutdown
Browse files Browse the repository at this point in the history
Shutdown tracing after runtime
  • Loading branch information
openshift-merge-robot authored Oct 15, 2022
2 parents 1817cd5 + e517a45 commit ee7f609
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions conmon-rs/server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,15 @@ impl Server {
.map_err(errno::from_i32)
.context("set child subreaper")?;

let enable_tracing = self.config().enable_tracing();

let rt = Builder::new_multi_thread().enable_all().build()?;
rt.block_on(self.spawn_tasks())?;

if enable_tracing {
Telemetry::shutdown();
}

rt.shutdown_background();
Ok(())
}
Expand Down Expand Up @@ -212,16 +219,12 @@ impl Server {
async fn start_backend(self, mut shutdown_rx: oneshot::Receiver<()>) -> Result<()> {
let listener =
Listener::<DefaultListener>::default().bind_long_path(&self.config().socket())?;
let enable_tracing = self.config().enable_tracing();
let client: conmon::Client = capnp_rpc::new_client(self);

loop {
let stream = tokio::select! {
_ = &mut shutdown_rx => {
debug!("Received shutdown message");
if enable_tracing {
Telemetry::shutdown();
}
return Ok(())
}
stream = listener.accept() => {
Expand Down

0 comments on commit ee7f609

Please sign in to comment.