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

feat: Add AsyncBacktraceLayer to allow users dump this execution tree at runtime #2617

Closed
Xuanwo opened this issue Jul 12, 2023 · 4 comments · Fixed by #2765
Closed

feat: Add AsyncBacktraceLayer to allow users dump this execution tree at runtime #2617

Xuanwo opened this issue Jul 12, 2023 · 4 comments · Fixed by #2765
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Jul 12, 2023

https://github.com/tokio-rs/async-backtrace

Efficient, logical 'stack' traces of async functions.

#[async_backtrace::framed]
async fn pending() {
    std::future::pending::<()>().await
}

#[async_backtrace::framed]
async fn foo() {
    bar().await;
}

#[async_backtrace::framed]
async fn bar() {
    futures::join!(fiz(), buz());
}

#[async_backtrace::framed]
async fn fiz() {
    tokio::task::yield_now().await;
}

#[async_backtrace::framed]
async fn buz() {
    println!("{}", baz().await);
}
@Xuanwo Xuanwo added good first issue Good for newcomers help wanted Extra attention is needed labels Jul 12, 2023
@suyanhanx suyanhanx changed the title faet: Add AsyncBacktrace to allow users dump this execution tree at runtime feat: Add AsyncBacktrace to allow users dump this execution tree at runtime Jul 12, 2023
@Xuanwo Xuanwo changed the title feat: Add AsyncBacktrace to allow users dump this execution tree at runtime feat: Add AsyncBacktraceLayer to allow users dump this execution tree at runtime Jul 13, 2023
@Xuanwo
Copy link
Member Author

Xuanwo commented Jul 13, 2023

Similiar to #2616, but powered by async-backtrace.

@dqhl76
Copy link
Member

dqhl76 commented Jul 25, 2023

Please /assign me!

@dqhl76
Copy link
Member

dqhl76 commented Aug 2, 2023

It seems we cannot use async-backtrace to create a new layer.

#[async_backtrace::framed] will change the fn read 's signature.

impl<A: Accessor> LayeredAccessor for AsyncBacktraceAccessor<A> {
    ...
    #[async_backtrace::framed]
    async fn read(&self, path: &str, args: OpRead) -> Result<(RpRead, Self::Reader)> {
        self.inner.read(path, args).await
    }
    ...
}

The example code below will give an error Not all trait items implemented, missing: read [E0046]

@Xuanwo
Copy link
Member Author

Xuanwo commented Aug 2, 2023

It's a bit strange. Could you create a draft PR so that we can identify the root cause?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants