diff --git a/Cargo.lock b/Cargo.lock index 70dadd1f2f939c0c8b755de23e6a25703fe14b21..24b4c5b3ec92f49d2a29cc08e847787ed9206cab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16890,6 +16890,17 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "tracing-tracy" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eaa1852afa96e0fe9e44caa53dc0bd2d9d05e0f2611ce09f97f8677af56e4ba" +dependencies = [ + "tracing-core", + "tracing-subscriber", + "tracy-client", +] + [[package]] name = "tracy-client" version = "0.18.2" @@ -20358,6 +20369,9 @@ dependencies = [ "time", "title_bar", "toolchain_selector", + "tracing", + "tracing-subscriber", + "tracing-tracy", "tracy-client", "tree-sitter-md", "tree-sitter-rust", diff --git a/Cargo.toml b/Cargo.toml index 9581175e1bdb3a35896536e6fec38b433f119bb6..58dd51ed14a33885b7823503a429cff941134bbe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -667,6 +667,9 @@ tokio = { version = "1" } tokio-tungstenite = { version = "0.26", features = ["__rustls-tls"] } toml = "0.8" tower-http = "0.4.4" +tracing = "0.1.40" +tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json", "registry", "tracing-log"] } # workaround for https://github.com/tokio-rs/tracing/issues/2927 +tracing-tracy = { version = "0.11.4", default-features = false, features = ["enable"] } tracy-client = { version = "0.18.2", default-features = false, features = ["enable", "demangle"] } tree-sitter = { version = "0.25.10", features = ["wasm"] } tree-sitter-bash = "0.25.0" diff --git a/crates/collab/Cargo.toml b/crates/collab/Cargo.toml index d95b318b0e791b532a340bda94d945fb7c9485c1..8804f19f95184adbcd82fac8e02a6453e58d9ca1 100644 --- a/crates/collab/Cargo.toml +++ b/crates/collab/Cargo.toml @@ -64,8 +64,8 @@ tokio = { workspace = true, features = ["full"] } toml.workspace = true tower = "0.4" tower-http = { workspace = true, features = ["trace"] } -tracing = "0.1.40" -tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json", "registry", "tracing-log"] } # workaround for https://github.com/tokio-rs/tracing/issues/2927 +tracing.workspace = true +tracing-subscriber.workspace = true util.workspace = true uuid.workspace = true workspace-hack.workspace = true diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 9d993ff4eb4c097004fff243be2ec5fefe902d3c..6ca53861db50f355eaf899d3ed5860762ad99d9d 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -19,7 +19,7 @@ name = "zed" path = "src/main.rs" [features] -tracy = ["dep:tracy-client", "gpui/tracy"] +tracy = ["dep:tracy-client", "dep:tracing", "dep:tracing-subscriber", "dep:tracing-tracy", "gpui/tracy"] tracy-memory = ["tracy"] [dependencies] @@ -150,6 +150,9 @@ theme_selector.workspace = true time.workspace = true title_bar.workspace = true toolchain_selector.workspace = true +tracing = { workspace = true, optional = true } +tracing-subscriber = { workspace = true, optional = true } +tracing-tracy = { workspace = true, optional = true } tracy-client = { workspace = true, optional = true } ui.workspace = true ui_input.workspace = true diff --git a/crates/zed/src/zed-main.rs b/crates/zed/src/zed-main.rs index 8f4ef0a062fcb7d28f44025fd35e707779a08180..5fe18a6c64b3831b3691e11905d2ff4620f7196c 100644 --- a/crates/zed/src/zed-main.rs +++ b/crates/zed/src/zed-main.rs @@ -4,8 +4,14 @@ pub fn main() { #[cfg(feature = "tracy")] { + use tracing_subscriber::layer::SubscriberExt; + tracy_client::register_demangler!(); tracy_client::Client::start(); + tracing::subscriber::set_global_default( + tracing_subscriber::registry().with(tracing_tracy::TracyLayer::default()), + ) + .expect("setup tracy layer"); } // separated out so that the file containing the main function can be imported by other crates,