-
Notifications
You must be signed in to change notification settings - Fork 758
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
implement enabled_span
and enabled_event
#1900
Conversation
in general, please prefer to open PRs against |
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.
overall, this seems like a good direction. i'm unconvinced about the benefits of making a separate internal macro, versus just making all the cases with kind
s be part of the main enabled!
macro and have the event- and span-specific versions call into that --- open to discussion on that, though.
also, I had some minor naming and documentation suggestions.
thanks for working on this!
@hawkw I think all review is covered now. currently, I pass through this could be 1. left as is 2. or switched to allow users to pass I think #2 could be done backwards-compatibly in the future, as those parameters on the macro are un-documented as is |
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.
overall, this seems good; i had some minor comments
I only just saw this PR; sorry about that. To quote @hawkw from the issue:
I think I'd prefer to add this to the existing
That being said, I don't feel too strongly about these points, but I should've mentioned it before @guswynn implemented it. |
This PR already does that, it just also adds
Is your argument here essentially that because you don't think that people should use the API, you don't think it should be easy to use? I don't think this is a good approach. If we're going to provide something, we should make it straightforward and easy to use. If we don't think it should exist at all, we shouldn't provide the API, but if we've made the decision to have it, we shouldn't intentionally make it worse in order to discourage its use. If we commit to providing an API, stopping people from using it is solely a documentation problem. As a side note, I still don't understand where the idea that using My final argument in favor of separate macros is that they ensure that the callsite kind always has its |
all review should be handled! |
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.
this seems fine to me. i have a slight preference for putting all the tests in one file, but it's not a big deal
tracing/tests/specific_enabled.rs
Outdated
.done() | ||
.run(); | ||
|
||
tracing::collect::set_global_default(collector).unwrap(); |
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.
i would probably use the local default (set_default
) in these tests, so they can all be in the same file...having to put it in a separate file is kind of annoying. not a hard blocker though.
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.
Ill clean this up then merge!
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.
rather, ill clean this up, then yall can squash-and-merge
Spoke to Eliza on Discord. Quick summary:
|
I cant recreate that compilation failure, locally, on the same nightly... |
it appears to be a compiler regression, i've already opened rust-lang/rust#93821 for it. we can move forward with this PR regardless, since it's not our fault. |
## Motivation Closes #1892 ## Solution This branch adds new `span_enabled!` and `event_enabled!` macros. I went withe sharing as much of the macro as possible. The new macros were implemented by adding a `kind:` parameter to `enabled!`, and invoking `enabled!` with the appropriate `kind:` argument. This means in the docs, the macro only shows the `($($rest:tt)*)=> (...)` variant, but I think linking to the `enabled!` docs should be fine. Also, I find the macro pattern part of rustdoc to be very hard to understand, and I think many people dont look at it. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
## Motivation Closes #1892 ## Solution This branch adds new `span_enabled!` and `event_enabled!` macros. I went withe sharing as much of the macro as possible. The new macros were implemented by adding a `kind:` parameter to `enabled!`, and invoking `enabled!` with the appropriate `kind:` argument. This means in the docs, the macro only shows the `($($rest:tt)*)=> (...)` variant, but I think linking to the `enabled!` docs should be fine. Also, I find the macro pattern part of rustdoc to be very hard to understand, and I think many people dont look at it. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
## Motivation Closes #1892 ## Solution This branch adds new `span_enabled!` and `event_enabled!` macros. I went withe sharing as much of the macro as possible. The new macros were implemented by adding a `kind:` parameter to `enabled!`, and invoking `enabled!` with the appropriate `kind:` argument. This means in the docs, the macro only shows the `($($rest:tt)*)=> (...)` variant, but I think linking to the `enabled!` docs should be fine. Also, I find the macro pattern part of rustdoc to be very hard to understand, and I think many people dont look at it. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
## Motivation Closes #1892 ## Solution This branch adds new `span_enabled!` and `event_enabled!` macros. I went withe sharing as much of the macro as possible. The new macros were implemented by adding a `kind:` parameter to `enabled!`, and invoking `enabled!` with the appropriate `kind:` argument. This means in the docs, the macro only shows the `($($rest:tt)*)=> (...)` variant, but I think linking to the `enabled!` docs should be fine. Also, I find the macro pattern part of rustdoc to be very hard to understand, and I think many people dont look at it. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
## Motivation Closes #1892 ## Solution This branch adds new `span_enabled!` and `event_enabled!` macros. I went withe sharing as much of the macro as possible. The new macros were implemented by adding a `kind:` parameter to `enabled!`, and invoking `enabled!` with the appropriate `kind:` argument. This means in the docs, the macro only shows the `($($rest:tt)*)=> (...)` variant, but I think linking to the `enabled!` docs should be fine. Also, I find the macro pattern part of rustdoc to be very hard to understand, and I think many people dont look at it. Co-authored-by: Eliza Weisman <eliza@buoyant.io>
# 0.1.33 (April 9, 2022) This release adds new `span_enabled!` and `event_enabled!` variants of the `enabled!` macro, for testing whether a subscriber would specifically enable a span or an event. ### Added - `span_enabled!` and `event_enabled!` macros ([#1900]) - Several documentation improvements ([#2010], [#2012]) ### Fixed - Compilation warning when compiling for <=32-bit targets (including `wasm32`) ([#2060]) Thanks to @guswynn, @arifd, @hrxi, @CAD97, and @name1e5s for contributing to this release! [#1900]: #1900 [#2010]: #2010 [#2012]: #2012 [#2060]: #2060
# 0.1.33 (April 9, 2022) This release adds new `span_enabled!` and `event_enabled!` variants of the `enabled!` macro, for testing whether a subscriber would specifically enable a span or an event. ### Added - `span_enabled!` and `event_enabled!` macros ([#1900]) - Several documentation improvements ([#2010], [#2012]) ### Fixed - Compilation warning when compiling for <=32-bit targets (including `wasm32`) ([#2060]) Thanks to @guswynn, @arifd, @hrxi, @CAD97, and @name1e5s for contributing to this release! [#1900]: #1900 [#2010]: #2010 [#2012]: #2012 [#2060]: #2060
# 0.1.33 (April 9, 2022) This release adds new `span_enabled!` and `event_enabled!` variants of the `enabled!` macro, for testing whether a subscriber would specifically enable a span or an event. ### Added - `span_enabled!` and `event_enabled!` macros ([tokio-rs#1900]) - Several documentation improvements ([tokio-rs#2010], [tokio-rs#2012]) ### Fixed - Compilation warning when compiling for <=32-bit targets (including `wasm32`) ([tokio-rs#2060]) Thanks to @guswynn, @arifd, @hrxi, @CAD97, and @name1e5s for contributing to this release! [tokio-rs#1900]: tokio-rs#1900 [tokio-rs#2010]: tokio-rs#2010 [tokio-rs#2012]: tokio-rs#2012 [tokio-rs#2060]: tokio-rs#2060
Motivation
Closes #1892
Solution
I went with sharing as much of the macro as possible. This means in the docs, the macro only shows the
($($rest:tt)*)=> (...)
variant, but I think linking to theenabled!
docs should be fine. Also, I find the macro pattern part of rustdoc to be very hard to understand, and I think many people dont look at it@hawkw I went ahead and put this pr against the v0.1 branch, let me know if you prefer master and backporting