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
tracing: add resource instrumentation using declarative macros #3933
tracing: add resource instrumentation using declarative macros #3933
Conversation
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
I am not entirely sure how I can get around
Seems this is triggered by the fact that test load the file module and the macro cannot be resolved...
|
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
tokio/src/macros/instrument.rs
Outdated
resource_span:tracing::trace_span!( | ||
"resource", | ||
concrete_type = stringify!($struct), | ||
kind = stringify!($resource_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, take it or leave it: why match the resource kind as an identifier and then stringify it? it might be simpler to just have the macro take a string literal...unless we care about ensuring that the kind is a valid Rust identifier?
I'm OK merging this as is to keep moving, but I don't think that this is the right way to instrument I'm leaning towards @seanmonstar's idea of just creating a span per Additionally, do we instrument if an operation (e.g. sleep) completes successfully or is cancelled? |
@carllerche I see, not sure if it is worth merging if that does not seem the correct approach. So what do we precisely need/want? I also feel it makes much more sense to track the async operation from first poll to returning result or erroring. I am not sure what having a new span per poll_* invocation gives us much. So a few questions.
|
Well, I don't think we know exactly what we want yet and IMO there is value in getting some data to show up in the console sooner than later. This is all flagged as experimental so we can figure it out as we go. That is my thinking, I'll defer to @seanmonstar / @hawkw on the call.
Well, the reason I moved away from this is that it isn't a perfect heuristic. You could imagine doing a
I am not sure, but I can't think of an error-proof way to do this.
In theory, there should be no concurrent calls to
We should instrument the extension traits. One option would be to track
Maybe @hawkw has a thought here. We may need to emit special events within the span.
Personally, I would avoid macros initially until we have figured out the pattern. All that said, again, I think it is fine to just move forward and tweak as we go. We want to start seeing resource instrumentation in |
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
Looks like all the feedback has been addressed, anything keeping us from merging? |
@seanmonstar I do not think so. Unless there are objections, this PR is in line with the RFC. Actually, I will try and get this view put together before we merge this. I think that this will inform any changes we need to make here |
Closing in favour of #4072 |
This PR adds macros that help instrument a resource
and its respective ops. It is an alternative version of #3893