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

Make tracing an optional feature #331

Open
zeenix opened this issue Apr 26, 2023 · 6 comments
Open

Make tracing an optional feature #331

zeenix opened this issue Apr 26, 2023 · 6 comments
Labels
api break enhancement New feature or request zbus Issues/PRs related to zbus crate

Comments

@zeenix
Copy link
Contributor

zeenix commented Apr 26, 2023

In GitLab by @bilelmoussaoui on Apr 26, 2023, 10:09

It ends up pulling tracing/ tracing-core / tracing-attributes indirectly. As in the libraries I wrote on top of zbus, I explicitly added a tracing feature, I would love if that feature would also control zbus's future tracing support.

@zeenix
Copy link
Contributor Author

zeenix commented Apr 27, 2023

Sure, feel free to make it happen. :)

@zeenix zeenix added enhancement New feature or request good first issue Good for newcomers zbus Issues/PRs related to zbus crate labels May 13, 2023
@zeenix
Copy link
Contributor Author

zeenix commented Mar 19, 2024

@bilelmoussaoui this will unfortunately be a breaking change though for tokio users since they typically disable the default features. If we don't add this to the default features, then it breaks for everyone cause they now have to explicitly enabled it.

@zeenix zeenix added this to the zbus-5.0 milestone Mar 19, 2024
@zeenix zeenix removed the good first issue Good for newcomers label Mar 19, 2024
@bilelmoussaoui
Copy link
Contributor

@bilelmoussaoui this will unfortunately be a breaking change though for tokio users since they typically disable the default features. If we don't add this to the default features, then it breaks for everyone cause they now have to explicitly enabled it.

I am ok with it being a default feature

@zeenix
Copy link
Contributor Author

zeenix commented Mar 19, 2024

I am ok with it being a default feature

Yeah, of course but that doesn't help with the issue I described.

@REALERvolker1
Copy link

I decided to work on this a little bit today, but I ran into a problem with the tracing::instrument declarations. I made a reddit post asking for help. Basically I want to have instrumented functions, but I want the macro to expand into the attribute macro declaration. I plan on adding macros that expand into the tracing macros when the tracing feature is enabled, and macros that expand into nothing when it is disabled.

How does that sound?

@zeenix
Copy link
Contributor Author

zeenix commented Apr 2, 2024

I decided to work on this a little bit today, but I ran into a problem with the tracing::instrument declarations. I made a reddit post asking for help. Basically I want to have instrumented functions, but I want the macro to expand into the attribute macro declaration. I plan on adding macros that expand into the tracing macros when the tracing feature is enabled, and macros that expand into nothing when it is disabled.

Thanks for taking it up. 👍

How does that sound?

Sounds good but the simpler/cleaner the solution, the better. The cfg_attr suggestion on Reddit, might be your best bet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api break enhancement New feature or request zbus Issues/PRs related to zbus crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants