tracing-attributes
Procedural macro attributes for automatically instrumenting functions.
0.1.31
691M downloads/mo
#124 most downloaded on crates.io
tokio-rs/tracing
What this package is like to depend on
Last release 9 months ago
26 Nov 2025
Release timing varies
gaps range from 2 weeks to 1.1 years
Nearly every release is documented
notes for 30 of 30 stable releases
2 versions withdrawn
withdrawn after publishing
7 years old
32 releases · first in 2019
1 release in the last 12 months
see the full history below
Release timeline
32 releases · Aug 2019 to Nov 2025Releases
latest 32-
0.1.3126 Nov 2025 -
0.1.3017 Jun 2025 -
0.1.2906 Jun 2025 -
0.1.2826 Nov 2024Release notes
Open source →Changed
- Bump MSRV to 1.63 (#2793)
Fixed
- Added missing RecordTypes for instrument (#2781)
- Change order of async and unsafe modifier (#2864)
- Extract match scrutinee (#2880)
- Allow field path segments to be keywords (#2925)
- Support const values for
targetandname(#2941)
Documented
- Fix backporting error in attributes (#2780)
-
0.1.2713 Oct 2023Release notes
Open source →Changed
- Bump minimum version of proc-macro2 to 1.0.60 (#2732)
- Generate less dead code for async block return type hint (#2709)
Fixed
- Fix a compilation error in
#[instrument]when the"log"feature is enabled (#2599)
-
0.1.2622 Jun 2023Release notes
Open source →This release of
tracing-attributesfixes warnings due toallowattributes in generated code that allow lints which may not exist on earlier versions of rustc.Fixed
- Allow
unknown_lintsin macro-generated code ([#2626])
Thanks to @mladedav for contributing to this release!
- Allow
-
0.1.2519 Jun 2023Release notes
Open source →This release of
tracing-attributesfixes the Clippy lintlet_with_type_underscorein code generated by the#[instrument]attribute in Rust 1.70+.Fixed
- Allow [
clippy::let_with_type_underscore] in macro-generated code (#2609)
Thanks to @coolreader19 for contributing to this release!
- Allow [
-
0.1.2424 Apr 2023Release notes
Open source →This release of
tracing-attributesadds support for passing an optionallevelto theerrandretarguments to#[instrument], allowing the level of the generated return-value event to be overridden. For example,#[instrument(err(level = "info"))] fn my_great_function() -> Result<(), &'static str> { // ... }will emit an
INFO-level event if the function returns anErr.In addition, this release updates the
syndependency to v2.x.x.Added
levelargument toerrandretto override the level of the generated return value event (#2335)- Improved compiler error message when
#[instrument]is added to aconst fn(#2418)
Changed
- Updated
syndependency to 2.0 (#2516)
Fixed
- Fix
clippy::unreachablewarnings in#[instrument]-generated code (#2356) - Removed unused "visit" feature flag from
syndependency (#2530)
Documented
Thanks to @nitnelave, @jsgf, @Abhicodes-crypto, @LukeMathWalker, @andrewpollack, @quad, @klensy, @davidpdrsn, and @dbidwell94 for contributign to this release!
-
0.1.2306 Oct 2022Release notes
Open source →This release of
tracing-attributesfixes a bug where compiler diagnostic spans for type errors in#[instrument]edasync fns have the location of the#[instrument]attribute rather than the location of the actual error, and a bug where inner attributes in#[instrument]ed functions would cause a compiler error.Fixed
- Fix incorrect handling of inner attributes in
#[instrument]ed functions (#2307) - Add fake return to improve spans generated for type errors in
async fns (#2270) - Updated
syndependency to fix compilation with-Z minimal-versions(#2246)
Thanks to new contributors @compiler-errors and @e-nomem, as well as @CAD97, for contributing to this release!
- Fix incorrect handling of inner attributes in
-
0.1.2201 Jul 2022Release notes
Open source →This release fixes an issue where using the
errorretarguments to#[instrument]along with an overridden target, such as#[instrument(target = "...", err, ret)]would not propagate the overridden target to the events generated for errors/return values.
Fixed
- Error and return value events generated by
#[instrument(err)]or#[instrument(ret)]not inheriting an overridden target (#2184) - Incorrect default level in documentation (#2119)
Thanks to new contributor @tbraun96 for contributing to this release!
- Error and return value events generated by
-
0.1.2127 Apr 2022Release notes
Open source →This release adds support for setting explicit parent and follows-from spans in the
#[instrument]attribute.Added
#[instrument(follows_from = ...)]argument for setting one or more follows-from span (#2093)#[instrument(parent = ...)]argument for overriding the generated span's parent (#2091)
Fixed
- Extra braces around
asyncblocks in expanded code (causes a Clippy warning) (#2090) - Broken documentation links (#2068, #2077)
Thanks to @jarrodldavis, @ben0x539, and new contributor @jswrenn for contributing to this release!
-
0.1.2008 Mar 2022Release notes
Open source →Fixed
- Compilation failure with
--minimal-versionsdue to a too-permissivesyndependency (#1960)
Changed
- Bumped minimum supported Rust version (MSRV) to 1.49.0 (#1913)
Thanks to new contributor @udoprog for contributing to this release!
- Compilation failure with
-
0.1.1904 Feb 2022Release notes
Open source →This release introduces a new
#[instrument(ret)]argument to emit an event with the return value of an instrumented function.Added
#[instrument(ret)]to record the return value of a function (#1716)- added
err(Debug)argument to cause#[instrument(err)]to record errors withDebugrather than `Display (#1631)
Fixed
- incorrect code generation for functions returning async blocks (#1866)
- incorrect diagnostics when using
rust-analyzer(#1634)
Thanks to @Swatinem, @hkmatsumoto, @cynecx, and @ciuncan for contributing to this release!
-
0.1.1805 Oct 2021Release notes
Open source →This release fixes issues introduced in v0.1.17.
Fixed
- fixed mismatched types compiler error that may occur when using
#[instrument]on anasync fnthat returns animpl Traitvalue that includes a closure (#1616) - fixed false positives for
clippy::suspicious_else_formattingwarnings due to rust-lang/rust-clippy#7760 and rust-lang/rust-clippy#6249 (#1617) - fixed
clippy::let_unit_valuelints when using#[instrument](#1614)
- fixed mismatched types compiler error that may occur when using
-
0.1.1701 Oct 2021 withdrawnRelease notes
Open source →This release significantly improves performance when
#[instrument]-generated spans are below the maximum enabled level.Added
Thanks to @oli-obk for contributing to this release!
-
0.1.1613 Sep 2021Release notes
Open source →This release adds a new
#[instrument(skip_all)]option to skip recording all arguments to an instrumented function as fields. Additionally, it adds support for recording arguments that aretracingprimitive types as typed values, rather than asfmt::Debug.Added
- add
skip_alloption to#[instrument](#1548) - record primitive types as primitive values rather than as
fmt::Debug(#1378) - added support for
f64s as typed values (#1522)
Thanks to @Folyd and @jsgf for contributing to this release!
- add
-
0.1.1512 Mar 2021Release notes
Open source →Fixed
#[instrument]on functions returningBox::pinned futures incorrectly skipping function bodies prior to returning a future (#1297)
Thanks to @nightmared for contributing to this release!
-
0.1.1410 Mar 2021Release notes
Open source →Fixed
- Compatibility between
#[instrument]andasync-traitv0.1.43 and newer (#1228)
Thanks to @nightmared for lots of hard work on this fix!
- Compatibility between
-
0.1.1317 Feb 2021Release notes
Open source →Fixed
- Compiler error when using
#[instrument(err)]on functions which returnimpl Trait(#1236)
- Compiler error when using
-
0.1.1204 Feb 2021Release notes
Open source →Fixed
- Compiler error when using
#[instrument(err)]on functions with mutable parameters (#1167) - Missing function visibility modifier when using
#[instrument]withasync-trait(#977) - Multiple documentation fixes and improvements (#965, #981, #1215)
Changed
tracing-futuresdependency is no longer required when using#[instrument]on async functions (#808)
Thanks to @nagisa, @Txuritan, @TaKO8Ki, and @okready for contributing to this release!
- Compiler error when using
-
0.1.1118 Aug 2020Release notes
Open source →Fixed
- Corrected wrong minimum supported Rust version note in docs (#941)
- Removed unused
synfeatures (#928)
Thanks to new contributor @jhpratt for contributing to this release!
-
0.1.1010 Aug 2020 withdrawnRelease notes
Open source →Added
- Support for using
selfin field expressions when instrumentingasync-traitfunctions (#875) - Several documentation improvements (#832, #897, #911, #913)
Thanks to @anton-dutov and @nightmared for contributing to this release!
- Support for using
-
0.1.908 Jul 2020Release notes
Open source →Added
- Support for arbitrary expressions as fields in
#[instrument](#672)
Changed
#[instrument]now emits a compiler warning when ignoring unrecognized input (#672, #786)
- Support for arbitrary expressions as fields in
-
0.1.814 May 2020Release notes
Open source →Added
- Support for using
#[instrument]on methods that are part ofasync-traittrait implementations (#711) - Optional
#[instrument(err)]argument to automatically emit an event if an instrumented function returnsErr(#637)
Thanks to @ilana and @nightmared for contributing to this release!
- Support for using
-
0.1.726 Feb 2020Release notes
Open source →Added
- Support for adding arbitrary literal fields to spans generated by
#[instrument](#569) #[instrument]now emits a helpful compiler error when attempting to skip a function parameter (#600)
Thanks to @Kobzol for contributing to this release!
- Support for adding arbitrary literal fields to spans generated by
-
0.1.620 Dec 2019 -
0.1.523 Oct 2019Release notes
Open source →Added
- Support for destructuring in arguments to
#[instrument]ed functions (#397) - Generated field for
selfparameters when#[instrument]ing methods (#397)
- Support for destructuring in arguments to
-
0.1.426 Sep 2019Release notes
Open source →Added
- Optional
skipargument to#[instrument]for excluding function parameters from generated spans (#359)
Release notes
Open source →Added
- Parent option for default sampler
Fixed
- SDK tracer default span id
- Optional
-
0.1.312 Sep 2019Release notes
Open source →Fixed
- Fixed
#[instrument]ed async functions not compiling onnightly-2019-09-11or newer (#342)
Release notes
Open source →Changed
- Ensure spans are always send and sync
- Allow static lifetimes for span names
- Improve KeyValue ergonomics
- Fixed
-
0.1.220 Aug 2019Release notes
Open source →Changed
- Updated
synandquotedependencies to 1.0 (#292) - Removed direct dependency on
proc-macro2to avoid potential version conflicts (#296)
Fixed
- Outdated idioms in examples (#271, #273)
- Updated
-
0.1.109 Aug 2019Release notes
Open source →Changed
- Using the
#[instrument]attribute onasync fns no longer requires a feature flag (#258)
Fixed
- The
#[instrument]macro now works on generic functions (#262)
Release notes
Open source →Added
- Documentation and API cleanup
- Tracking of active spans via thread local span stack
- Using the
-
0.1.008 Aug 2019