Macro attributes for application-level tracing.
tracing is a framework for instrumenting Rust programs to collect
structured, event-based diagnostic information. This crate provides the
#[instrument] attribute for automatically instrumenting functions using
tracing.
Note that this macro is also re-exported by the main tracing crate.
Compiler support: requires rustc 1.65+
If it wasn't already obvious, this is a manual fork of the tracing-attributes
crate, created to re-allow crate re-exports of the #[tracing::instrument]
proc_macro. It was created using the following process;
git clone git@github.com:tokio-rs/tracing.git tracing-attributes
cd tracing-attributes
git checkout tracing-attributes-0.1.29
git checkout -b li_tracing-attributes-0.1.29
git rm Cargo.toml clippy.toml CONTRIBUTING.md LICENSE netlify.toml README.md SECURITY.md
git rm -r assets
git rm -r bin
git rm -r examples
git rm -r tracing
git rm -r tracing-appender
git rm -r tracing-core
git rm -r tracing-error
git rm -r tracing-flame
git rm -r tracing-futures
git rm -r tracing-journald
git rm -r tracing-log
git rm -r tracing-macros
git rm -r tracing-serde
git rm -r tracing-subscriber
git rm -r tracing-tower
git mv tracing-attributes/* .
rm -r tracing-attributes
perl -pi -e 's;{ path = "\.\./tracing", version = "(.*)" };"\1";' Cargo.toml
perl -pi -e 's;\.\./tracing-mock;\./tracing-mock;' Cargo.toml
perl -pi -e 's;\.\./tracing-test;\./tracing-test;' Cargo.toml
perl -pi -e 's;path = "\.\./tracing-subscriber", ;;' Cargo.toml
perl -ni -e 'print unless m;\[lints\];' Cargo.toml
perl -ni -e 'print unless m;workspace = true' Cargo.toml
perl -pi -e 's;path = "\.\./tracing", ;;' tracing-mock/Cargo.toml
perl -pi -e 's;path = "\.\./tracing-core", ;;' tracing-mock/Cargo.toml
perl -pi -e 's;path = "\.\./tracing-subscriber", ;;' tracing-mock/Cargo.toml
perl -ni -e 'print unless m;\[lints\];' tracing-mock/Cargo.toml
perl -ni -e 'print unless m;workspace = true' tracing-mock/Cargo.toml
git add .
git ci -m "Reduce repo to tracing-attributes"
# Revert the 'Globally qualify attribute paths' commit
git revert 4deba4aaeae5099b3eabda67c510612ae4fb653c -X theirs --commitFirst, add this to your Cargo.toml:
[dependencies]
tracing-attributes = "0.1.29"This crate provides the #[instrument] attribute for instrumenting a function
with a tracing span. For example:
use tracing_attributes::instrument;
#[instrument]
pub fn my_function(my_arg: usize) {
// ...
}Tracing is built against the latest stable release. The minimum supported version is 1.65. The current Tracing version is not guaranteed to build on Rust versions earlier than the minimum supported version.
Tracing follows the same compiler support policies as the rest of the Tokio project. The current stable Rust compiler and the three most recent minor versions before it will always be supported. For example, if the current stable compiler version is 1.69, the minimum supported version will not be increased past 1.66, three minor versions prior. Increasing the minimum supported compiler version is not considered a semver breaking change as long as doing so complies with this policy.
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tokio by you, shall be licensed as MIT, without any additional terms or conditions.