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

Expose tracing_core::span::Current from tracing #504

Closed
anp opened this issue Jan 3, 2020 · 4 comments
Closed

Expose tracing_core::span::Current from tracing #504

anp opened this issue Jan 3, 2020 · 4 comments
Labels
crate/core Related to the `tracing-core` crate kind/feature New feature or request

Comments

@anp
Copy link
Contributor

anp commented Jan 3, 2020

Feature Request

Motivation

Implement a subscriber only using types exported from the tracing crate without having to reference tracing-core directly.

Proposal

Re-export under tracing::span::Current.

Alternatives

Probably, not sure though.

@hawkw
Copy link
Member

hawkw commented Jan 3, 2020

I think we can definitely do this. Any particular motivation for not depending on tracing-core explicitly, or just simplifying imports & dependencies?

@anp
Copy link
Contributor Author

anp commented Jan 3, 2020

Just simplifying imports & dependencies. If I'm already consuming everything else from tracing-core via tracing, it's a weird cliff in the API to add just one item. Alternatively, exposing it via tracing-subscriber could make sense? While it's not guaranteed that every implementor of tracing_core::Subscriber would consume tracing-subscriber, it would be true in my case at least.

@hawkw
Copy link
Member

hawkw commented Jan 3, 2020

In general, I think a subscriber being implemented in the same crate as code that's implemented using tracing is not the most common case...generally, I expect subscriber implementations to be standalone crates that either depend on tracing-core or tracing-subscriber. If you're using tracing-subscriber, you're probably implementing the Layer trait rather than the Subscriber trait, and in that case, you don't need the span::Current type.

With that said, I'm totally fine with adding the re-export. It's just that up until this point there wasn't really any demand for it & I wanted to keep each crate's API surface small to avoid information overload.

@hawkw hawkw added crate/core Related to the `tracing-core` crate kind/feature New feature or request labels Jan 3, 2020
@anp
Copy link
Contributor Author

anp commented Jan 3, 2020

Right, this all makes sense. I think my confusion would have been better prevented by better subscriber docs (#505 (comment)), so I’ll close this without a clear motivator and since I probably won’t need to reference Current after all.

@anp anp closed this as completed Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate/core Related to the `tracing-core` crate kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants