Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discuss: Add custom location name support #40

Open
Xuanwo opened this issue May 16, 2024 · 0 comments
Open

discuss: Add custom location name support #40

Xuanwo opened this issue May 16, 2024 · 0 comments

Comments

@Xuanwo
Copy link

Xuanwo commented May 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant