-
Notifications
You must be signed in to change notification settings - Fork 434
Add tracing support #720
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Add tracing support #720
Conversation
This is awesome, thanks! Is there any way to unit test the traces? This is simple but in the future we want to add spans and the like. |
Unit test the proc macros or the actual traces? |
The actual traces...if people are relying on tracing support I want to make sure we don't break it in the future. |
Would be sweet to integrate https://docs.rs/tracing-futures/0.2.4/tracing_futures/. Actually, looks like it may not be needed soon: |
Ah, it looks like the test harness will be usable soon: |
Note this can't land yet as it is pointing to a random git repo. Once the PR lands and a release is cut this can land. |
Great stuff, thanks for the help with the PR! I don't think that the span can be created with a declarative macro. Because the macro has to return a block, the span guard goes out of scope immediately, thus ending the span. I'll look into creating a proc macro instead. I'll also look into writing unit tests. |
If you'll see, the sync span macro doesn't create a block so it doesn't get dropped immediately. For the async case, it gets attached to a future and works fine. There is already a proc macro in |
If in the tracing example the queries are made to fail, the following output is given:
Expected:
|
Ah, my mistake! We can totally do a proc macro. |
This reverts commit 753c80f.
Ugh, I think I screwed git up here. |
Just curious what the state of landing this PR is? This would be great to have. Looks like tokio-rs/tracing#808 was merged in September. |
Still waiting for tokio-rs/tracing#793 for the tests, but I'm not sure if that should be a blocker considering that that PR has been open for a long time and it doesn't look like it's gonna be completed anytime soon. @LegNeato are you aware of something else that's outstanding? Anything I can help with? |
I'd also be happy to help out on this PR if there's anything I can help with. |
This is a stab at #713.
Considerations:
tracing
,#[cfg(feature = "tracing")]
tracing
orlog
Debug