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

How to add instrument for functions returns Poll<T>? #7

Open
Xuanwo opened this issue Jul 26, 2023 · 2 comments
Open

How to add instrument for functions returns Poll<T>? #7

Xuanwo opened this issue Jul 26, 2023 · 2 comments

Comments

@Xuanwo
Copy link

Xuanwo commented Jul 26, 2023

Hi, OpenDAL is currently developing an AwaitTreeLayer to give our users the ability to dump the execution tree at runtime: apache/opendal#2623

The missing part here is that how can we add instrument for functions returns Poll<T>? For example, AsyncRead will have API like the following:

pub trait AsyncRead {
    // Required method
    fn poll_read(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: &mut [u8]
    ) -> Poll<Result<usize, Error>>;

Can we add instrument for every poll operations?

@Xuanwo
Copy link
Author

Xuanwo commented Jul 26, 2023

cc @BugenZhao for discussion, thanks!

@BugenZhao
Copy link
Member

Great point! In theory, await-tree can be attached to any function that returns Poll. I'll investigate interface 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

2 participants