diff --git a/quickwit/quickwit-actors/src/scheduler.rs b/quickwit/quickwit-actors/src/scheduler.rs index 5adc5c1700c..723faddf5b2 100644 --- a/quickwit/quickwit-actors/src/scheduler.rs +++ b/quickwit/quickwit-actors/src/scheduler.rs @@ -215,7 +215,7 @@ pub fn start_scheduler() -> SchedulerClient { } } }, - "Scheduler", + "scheduler", ); scheduler_client } diff --git a/quickwit/quickwit-common/Cargo.toml b/quickwit/quickwit-common/Cargo.toml index 9acdd37f735..19924e38530 100644 --- a/quickwit/quickwit-common/Cargo.toml +++ b/quickwit/quickwit-common/Cargo.toml @@ -43,10 +43,7 @@ tracing = { workspace = true } testsuite = [] named_tasks = ["tokio/tracing"] - - [dev-dependencies] serde_json = { workspace = true } tempfile = { workspace = true } - quickwit-macros = { workspace = true } diff --git a/quickwit/quickwit-common/src/lib.rs b/quickwit/quickwit-common/src/lib.rs index eb3239503ca..5c57c580b8a 100644 --- a/quickwit/quickwit-common/src/lib.rs +++ b/quickwit/quickwit-common/src/lib.rs @@ -199,6 +199,26 @@ pub const fn div_ceil(lhs: i64, rhs: i64) -> i64 { } } + +// The following are helpers to build named tasks. +// +// Named tasks require the tokio feature `tracing` to be enabled. +// If the `named_tasks` feature is disabled, this is no-op. +// +// By default, these function will just ignore the name passed and just act +// like a regular call to `tokio::spawn`. +// +// If the user compiles `quickwit-cli` with the `tokio-console` feature, +// then tasks will automatically be named. This is not just "visual sugar". +// +// Without names, tasks will only show their spawn site on tokio-console. +// This is a catastrophy for actors who all share the same spawn site. +// +// # Naming +// +// Actors will get named after their type, which is fine. +// For other tasks, please use `snake_case`. + #[cfg(not(feature = "named_tasks"))] pub fn spawn_named_task(future: F, _name: &'static str) -> tokio::task::JoinHandle where diff --git a/quickwit/quickwit-indexing/src/actors/uploader.rs b/quickwit/quickwit-indexing/src/actors/uploader.rs index 98374ece488..23e27b86a8e 100644 --- a/quickwit/quickwit-indexing/src/actors/uploader.rs +++ b/quickwit/quickwit-indexing/src/actors/uploader.rs @@ -384,7 +384,7 @@ impl Handler for Uploader { Result::<(), anyhow::Error>::Ok(()) } .instrument(Span::current()), - "upload-single-task" + "upload_single_task" ); fail_point!("uploader:intask:after"); Ok(())