Add support for manual spans, expand instrumentation (#44663)

Release Notes:

- N/A

---------

Co-authored-by: Cameron <cameron@zed.dev>
This commit is contained in:
Yara 🏳️‍⚧️
2025-12-11 22:29:47 +00:00
committed by GitHub
co-authored by Cameron
parent 07748b7bae
commit 1029a8fbaf
13 changed files with 118 additions and 5 deletions
+37 -1
View File
@@ -1,10 +1,46 @@
pub use tracing::Level;
#[cfg(ztracing)]
pub use tracing::instrument;
pub use tracing::{
debug_span, error_span, event, info_span, instrument, span, trace_span, warn_span,
};
#[cfg(not(ztracing))]
pub use ztracing_macro::instrument;
#[cfg(not(ztracing))]
pub use __consume_all_tokens as trace_span;
#[cfg(not(ztracing))]
pub use __consume_all_tokens as info_span;
#[cfg(not(ztracing))]
pub use __consume_all_tokens as debug_span;
#[cfg(not(ztracing))]
pub use __consume_all_tokens as warn_span;
#[cfg(not(ztracing))]
pub use __consume_all_tokens as error_span;
#[cfg(not(ztracing))]
pub use __consume_all_tokens as event;
#[cfg(not(ztracing))]
pub use __consume_all_tokens as span;
#[cfg(not(ztracing))]
#[macro_export]
macro_rules! __consume_all_tokens {
($($t:tt)*) => {
$crate::FakeSpan
};
}
pub struct FakeSpan;
impl FakeSpan {
pub fn enter(&self) {}
}
// #[cfg(not(ztracing))]
// pub use span;
#[cfg(ztracing)]
pub fn init() {
zlog::info!("Starting tracy subscriber, you can now connect the profiler");
use tracing_subscriber::prelude::*;
tracing::subscriber::set_global_default(
tracing_subscriber::registry().with(tracing_tracy::TracyLayer::default()),