Skip to content

discuss: Add custom location name support #40

@Xuanwo

Description

@Xuanwo

Hi @jswrenn, thank you for your work. Databend has greatly benefited from this project, and I wanted to express my gratitude before making any proposals.


Databend currently users it's own fork developed by @zhang2014 that adding custom location name support so that we can inject location names at runtime:

impl TrySpawn for Runtime {
    #[track_caller]
    fn try_spawn<T>(&self, task: T) -> Result<JoinHandle<T::Output>>
    where
        T: Future + Send + 'static,
        T::Output: Send + 'static,
    {
        let task = ThreadTracker::tracking_future(task);
        let task = match ThreadTracker::query_id() {
            None => async_backtrace::location!(String::from(GLOBAL_TASK_DESC)).frame(task),
            Some(query_id) => {
                async_backtrace::location!(format!("Running query {} spawn task", query_id))
                    .frame(task)
            }
        };

        #[expect(clippy::disallowed_methods)]
        Ok(self.handle.spawn(task))
    }
}

Do you think this feature is a good addition? I'm willing to help implement it inside the upstream project under your guidance and design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions