mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-16 08:26:16 +00:00
Merge pull request #2813 from liubin/fix/2812-flush-root-span
agent: flush root span before process finish
This commit is contained in:
commit
b7cd4ca2b8
@ -200,12 +200,12 @@ async fn real_main() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
|||||||
let _ = tracer::setup_tracing(NAME, &logger, &config)?;
|
let _ = tracer::setup_tracing(NAME, &logger, &config)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let root = span!(tracing::Level::TRACE, "root-span", work_units = 2);
|
let root_span = span!(tracing::Level::TRACE, "root-span");
|
||||||
|
|
||||||
// XXX: Start the root trace transaction.
|
// XXX: Start the root trace transaction.
|
||||||
//
|
//
|
||||||
// XXX: Note that *ALL* spans needs to start after this point!!
|
// XXX: Note that *ALL* spans needs to start after this point!!
|
||||||
let _enter = root.enter();
|
let span_guard = root_span.enter();
|
||||||
|
|
||||||
// Start the sandbox and wait for its ttRPC server to end
|
// Start the sandbox and wait for its ttRPC server to end
|
||||||
start_sandbox(&logger, &config, init_mode, &mut tasks, shutdown_rx.clone()).await?;
|
start_sandbox(&logger, &config, init_mode, &mut tasks, shutdown_rx.clone()).await?;
|
||||||
@ -235,6 +235,10 @@ async fn real_main() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// force flushing spans
|
||||||
|
drop(span_guard);
|
||||||
|
drop(root_span);
|
||||||
|
|
||||||
if config.tracing != tracer::TraceType::Disabled {
|
if config.tracing != tracer::TraceType::Disabled {
|
||||||
tracer::end_tracing();
|
tracer::end_tracing();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user