Skip to content

Commit

Permalink
tracing: fix a typo and adds a note about the supported field syntax (#…
Browse files Browse the repository at this point in the history
…1232)

The `instrument` macro does not explain the syntax that can be used and
the main tracing docs only say that this syntax is valid for `span` and
`event` macros.

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
  • Loading branch information
lfrancke and hawkw committed Feb 17, 2021
1 parent f8b7d69 commit 9d4b7e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion tracing-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ use syn::{
/// Additional fields (key-value pairs with arbitrary data) may be added to the
/// generated span using the `fields` argument on the `#[instrument]` macro. Any
/// Rust expression can be used as a field value in this manner. These
/// expressions will be evaluated at the beginning of the function's body, sso
/// expressions will be evaluated at the beginning of the function's body, so
/// arguments to the function may be used in these expressions. Field names may
/// also be specified *without* values. Doing so will result in an [empty field]
/// whose value may be recorded later within the function body.
///
/// This supports the same [field syntax] as the `span!` and `event!` macros.
///
/// Note that overlap between the names of fields and (non-skipped) arguments
/// will result in a compile error.
///
Expand Down Expand Up @@ -437,6 +439,7 @@ use syn::{
/// [module path]: https://docs.rs/tracing/latest/tracing/struct.Metadata.html#method.module_path
/// [`INFO`]: https://docs.rs/tracing/latest/tracing/struct.Level.html#associatedconstant.INFO
/// [empty field]: https://docs.rs/tracing/latest/tracing/field/struct.Empty.html
/// [field syntax]: https://docs.rs/tracing/latest/tracing/#recording-fields
/// [`fmt::Debug`]: https://doc.rust-lang.org/std/fmt/trait.Debug.html
#[proc_macro_attribute]
pub fn instrument(
Expand Down
4 changes: 2 additions & 2 deletions tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@
//!
//! ## Using the Macros
//!
//! The [`span!`] and [`event!`] macros use fairly similar syntax, with some
//! exceptions.
//! The [`span!`] and [`event!`] macros as well as the `#[instrument]` attribute
//! use fairly similar syntax, with some exceptions.
//!
//! ### Configuring Attributes
//!
Expand Down

0 comments on commit 9d4b7e7

Please sign in to comment.