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

Check existence of arguments to tracing::instrument's skip attribute #562

Closed
d-e-s-o opened this issue Feb 4, 2020 · 1 comment · Fixed by #600
Closed

Check existence of arguments to tracing::instrument's skip attribute #562

d-e-s-o opened this issue Feb 4, 2020 · 1 comment · Fixed by #600
Labels
crate/attributes Related to the `tracing-attributes` crate good first issue Good for newcomers kind/feature New feature or request

Comments

@d-e-s-o
Copy link
Contributor

d-e-s-o commented Feb 4, 2020

Feature Request

The arguments to tracing::instrument's skip attribute are prone to get out of date, because there is no checking that a parameter of the provided name actually exists.

For example,

#[instrument(level = "info", skip(XYZ))]
pub async fn handler(foo: u32) {
  unimplemented!()
}

There is no argument called XYZ, but there is no error or warning indicating that. So whenever there is a rename of an argument chances are that an adjustment of the skip list is forgotten.

Crates

tracing 0.1.12

@hawkw
Copy link
Member

hawkw commented Feb 4, 2020

This is a great idea, thanks for the suggestion! I think it ought to be fairly simple to implement.

@hawkw hawkw added crate/attributes Related to the `tracing-attributes` crate good first issue Good for newcomers kind/feature New feature or request labels Feb 4, 2020
hawkw pushed a commit that referenced this issue Feb 25, 2020
This PR adds a check to the `#[instrument]` macro to emit a compiler
error if the user tries to skip non-existing parameters.

Fixes: #562
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate/attributes Related to the `tracing-attributes` crate good first issue Good for newcomers kind/feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants