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

add tracing feature #440

Merged
merged 1 commit into from
Feb 7, 2022
Merged

add tracing feature #440

merged 1 commit into from
Feb 7, 2022

Conversation

guswynn
Copy link
Contributor

@guswynn guswynn commented Feb 4, 2022

Much of the rust ecosystem uses tracing over log

This branch adds an optional feature tracing to rdkafka that uses tracing log lines instead of log ones. See https://github.com/MaterializeInc/materialize/blob/883710649f95d232ead5872518969a15c1def542/src/kafka-util/src/client.rs#L28-L47 for an example of how people have to work around this, over using the DefaultClientContext

Some notes:

  • tracing::enabled! is slightly different than log::log_enabled! in that it doesn't query the tracing subscriber for specifically Event type's. In practice, I have found this to be a vanishingly small difference, but with implement enabled_span and enabled_event tokio-rs/tracing#1900 this pr (after its landed, backported, and released), it could be possible to slightly improve
  • tracing log levels are consts, not variants, so I have to do some re-declaration to make them importable to make the enabled! callsites as easy as possible to use
  • I am not sure how to test this, other than just cargo test/check, but I need help setting up ci to exercise this

@guswynn
Copy link
Contributor Author

guswynn commented Feb 4, 2022

cc @benesch

The new `tracing` feature enables logging via the `tracing` crate's
macros rather than the `log` crate's macros.
@benesch
Copy link
Collaborator

benesch commented Feb 7, 2022

Thanks, @guswynn! I wired up CI to at least run cargo check with the new tracing feature enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants