From ef201ab3a9134c25b3d344a2df9c3f9ce74db88f Mon Sep 17 00:00:00 2001 From: David Barsky Date: Thu, 3 Aug 2023 18:38:14 -0400 Subject: [PATCH 1/6] chores: fix clippy lints (#2673) --- tracing-journald/src/socket.rs | 2 +- tracing-subscriber/src/fmt/time/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tracing-journald/src/socket.rs b/tracing-journald/src/socket.rs index bba53d8658..6803bf34e0 100644 --- a/tracing-journald/src/socket.rs +++ b/tracing-journald/src/socket.rs @@ -68,7 +68,7 @@ pub fn send_one_fd_to>(socket: &UnixDatagram, fd: RawFd, path: P) msg.msg_control = unsafe { cmsg_buffer.buffer.as_mut_ptr() as _ }; msg.msg_controllen = unsafe { CMSG_SPACE(size_of::() as _) as _ }; - let mut cmsg: &mut cmsghdr = + let cmsg: &mut cmsghdr = unsafe { CMSG_FIRSTHDR(&msg).as_mut() }.expect("Control message buffer exhausted"); cmsg.cmsg_level = SOL_SOCKET; diff --git a/tracing-subscriber/src/fmt/time/mod.rs b/tracing-subscriber/src/fmt/time/mod.rs index fd77b2c750..21d692bbb0 100644 --- a/tracing-subscriber/src/fmt/time/mod.rs +++ b/tracing-subscriber/src/fmt/time/mod.rs @@ -48,7 +48,7 @@ pub trait FormatTime { /// # } /// ``` pub fn time() -> SystemTime { - SystemTime::default() + SystemTime } /// Returns a new `Uptime` timestamp provider. From 79dd541ff63f9f860a954955a3123f63cf7173c0 Mon Sep 17 00:00:00 2001 From: Yuta Yamaguchi Date: Tue, 8 Aug 2023 03:28:05 +0900 Subject: [PATCH 2/6] tracing: add tracing-cloudwatch to related cates in README (#2667) --- README.md | 2 ++ tracing/src/lib.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 7fb11378ff..a9474453ca 100644 --- a/README.md +++ b/README.md @@ -403,6 +403,7 @@ are not maintained by the `tokio` project. These include: - [`tracing-logfmt`] provides a layer that formats events and spans into the logfmt format. - [`tracing-chrome`] provides a layer that exports trace data that can be viewed in `chrome://tracing`. - [`reqwest-tracing`] provides a middleware to trace [`reqwest`] HTTP requests. +- [`tracing-cloudwatch`] provides a layer that sends events to AWS CloudWatch Logs. (if you're the maintainer of a `tracing` ecosystem crate not in this list, please let us know!) @@ -445,6 +446,7 @@ please let us know!) [`tracing-chrome`]: https://crates.io/crates/tracing-chrome [`reqwest-tracing`]: https://crates.io/crates/reqwest-tracing [`reqwest`]: https://crates.io/crates/reqwest +[`tracing-cloudwatch`]: https://crates.io/crates/tracing-cloudwatch **Note:** that some of the ecosystem crates are currently unreleased and undergoing active development. They may be less stable than `tracing` and diff --git a/tracing/src/lib.rs b/tracing/src/lib.rs index 1494048523..f7439c75d1 100644 --- a/tracing/src/lib.rs +++ b/tracing/src/lib.rs @@ -808,6 +808,7 @@ //! - [`tracing-loki`] provides a layer for shipping logs to [Grafana Loki]. //! - [`tracing-logfmt`] provides a layer that formats events and spans into the logfmt format. //! - [`reqwest-tracing`] provides a middleware to trace [`reqwest`] HTTP requests. +//! - [`tracing-cloudwatch`] provides a layer that sends events to AWS CloudWatch Logs. //! //! If you're the maintainer of a `tracing` ecosystem crate not listed above, //! please let us know! We'd love to add your project to the list! @@ -848,6 +849,7 @@ //! [`tracing-logfmt`]: https://crates.io/crates/tracing-logfmt //! [`reqwest-tracing`]: https://crates.io/crates/reqwest-tracing //! [`reqwest`]: https://crates.io/crates/reqwest +//! [`tracing-cloudwatch`]: https://crates.io/crates/tracing-cloudwatch //! //!
//!

From 941b1591faeea55d62c1c8cf524ffa3e95b66887 Mon Sep 17 00:00:00 2001
From: Ana Hobden 
Date: Wed, 9 Aug 2023 11:52:16 -0700
Subject: [PATCH 3/6] documentation: Add article and talk by hoverbear (#2679)

---
 README.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/README.md b/README.md
index a9474453ca..3eedc95d07 100644
--- a/README.md
+++ b/README.md
@@ -462,14 +462,17 @@ Tracing.
 * [Diagnostics with Tracing][tokio-blog-2019-08] on the Tokio blog, August 2019
 * [Production-Grade Logging in Rust Applications][production-logging-2020], November 2020
 * [Custom Logging in Rust using `tracing` and `tracing-subscriber`, part 1][custom-logging-part-1] and [part 2][custom-logging-part-2], October 2021
+* [Instrumenting Axum projects][detsys-blog-2023-08], August 2023
 
 [tokio-blog-2019-08]: https://tokio.rs/blog/2019-08-tracing/
+[detsys-blog-2023-08]: https://determinate.systems/posts/instrumenting-axum
 
 #### Talks
 
 * [Bay Area Rust Meetup talk and Q&A][bay-rust-2019-03], March 2019
 * [RustConf 2019 talk][rust-conf-2019-08-video] and [slides][rust-conf-2019-08-slides], August 2019
 * [Are we observable yet? @ RustyDays talk][rusty-days-2020-08-video] and [slides][rusty-days-2020-08-slides], August 2020
+* [Crabs with instruments!][tremorcon-2021-09], September 2021
 
 [bay-rust-2019-03]: https://www.youtube.com/watch?v=j_kXRg3zlec
 [rust-conf-2019-08-video]: https://www.youtube.com/watch?v=JjItsfqFIdo
@@ -479,6 +482,7 @@ Tracing.
 [production-logging-2020]: https://medium.com/better-programming/production-grade-logging-in-rust-applications-2c7fffd108a6
 [custom-logging-part-1]: https://burgers.io/custom-logging-in-rust-using-tracing
 [custom-logging-part-2]: https://burgers.io/custom-logging-in-rust-using-tracing-part-2
+[tremorcon-2021-09]: https://www.youtube.com/watch?v=ZC7fyqshun8
 
 Help us expand this list! If you've written or spoken about Tracing, or
 know of resources that aren't listed, please open a pull request adding them.

From 5321e52263e24788a78363bd4411d8c04671bee3 Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Mon, 14 Aug 2023 19:08:45 +0200
Subject: [PATCH 4/6] core: ensure callsites in test have unique addresses
 (#2681)

The test relies on TEST_CALLSITE_1 and TEST_CALLSITE_2 to have
different addresses. However, as they are zero-sized types, this
is not guaranteed.

This fixes the test failure with LLVM 17 and certain optimization
options reported at https://github.com/rust-lang/rust/issues/114699.
---
 tracing-core/src/field.rs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tracing-core/src/field.rs b/tracing-core/src/field.rs
index 80ca065ba3..2c8596117c 100644
--- a/tracing-core/src/field.rs
+++ b/tracing-core/src/field.rs
@@ -978,8 +978,9 @@ mod test {
     use super::*;
     use crate::metadata::{Kind, Level, Metadata};
 
-    struct TestCallsite1;
-    static TEST_CALLSITE_1: TestCallsite1 = TestCallsite1;
+    // Make sure TEST_CALLSITE_* have non-zero size, so they can't be located at the same address.
+    struct TestCallsite1(u8);
+    static TEST_CALLSITE_1: TestCallsite1 = TestCallsite1(0);
     static TEST_META_1: Metadata<'static> = metadata! {
         name: "field_test1",
         target: module_path!(),
@@ -999,8 +1000,8 @@ mod test {
         }
     }
 
-    struct TestCallsite2;
-    static TEST_CALLSITE_2: TestCallsite2 = TestCallsite2;
+    struct TestCallsite2(u8);
+    static TEST_CALLSITE_2: TestCallsite2 = TestCallsite2(0);
     static TEST_META_2: Metadata<'static> = metadata! {
         name: "field_test2",
         target: module_path!(),

From 8f4157e0f8ee3bfaba075601d99b94cd48e63c24 Mon Sep 17 00:00:00 2001
From: Alexander Tesfamichael 
Date: Mon, 14 Aug 2023 19:09:18 +0200
Subject: [PATCH 5/6] docs(field): remove duplicate wording (#2674)

---
 tracing-core/src/field.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tracing-core/src/field.rs b/tracing-core/src/field.rs
index 2c8596117c..af884da429 100644
--- a/tracing-core/src/field.rs
+++ b/tracing-core/src/field.rs
@@ -1,8 +1,8 @@
 //! Span and `Event` key-value data.
 //!
-//! Spans and events may be annotated with key-value data, referred to as known
-//! as _fields_. These fields consist of a mapping from a key (corresponding to
-//! a `&str` but represented internally as an array index) to a [`Value`].
+//! Spans and events may be annotated with key-value data, known as _fields_.
+//! These fields consist of a mapping from a key (corresponding to a `&str` but
+//! represented internally as an array index) to a [`Value`].
 //!
 //! # `Value`s and `Collect`s
 //!

From 887b9e79bacc85f894688f4f4bc2ef93760c28f3 Mon Sep 17 00:00:00 2001
From: Jonathan Woollett-Light 
Date: Mon, 14 Aug 2023 18:11:28 +0100
Subject: [PATCH 6/6] docs: Add `clippy-tracing` to related crates (#2628)

## Motivation

Sharing tooling.

## Solution

Adds `clippy-tracing` to related crates.

Closes #2627
---
 README.md          | 2 ++
 tracing/src/lib.rs | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/README.md b/README.md
index 3eedc95d07..054f999b48 100644
--- a/README.md
+++ b/README.md
@@ -404,6 +404,7 @@ are not maintained by the `tokio` project. These include:
 - [`tracing-chrome`] provides a layer that exports trace data that can be viewed in `chrome://tracing`.
 - [`reqwest-tracing`] provides a middleware to trace [`reqwest`] HTTP requests.
 - [`tracing-cloudwatch`] provides a layer that sends events to AWS CloudWatch Logs.
+- [`clippy-tracing`] provides a tool to add, remove and check for `tracing::instrument`.
 
 (if you're the maintainer of a `tracing` ecosystem crate not in this list,
 please let us know!)
@@ -447,6 +448,7 @@ please let us know!)
 [`reqwest-tracing`]: https://crates.io/crates/reqwest-tracing
 [`reqwest`]: https://crates.io/crates/reqwest
 [`tracing-cloudwatch`]: https://crates.io/crates/tracing-cloudwatch
+[`clippy-tracing`]: https://crates.io/crates/clippy-tracing
 
 **Note:** that some of the ecosystem crates are currently unreleased and
 undergoing active development. They may be less stable than `tracing` and
diff --git a/tracing/src/lib.rs b/tracing/src/lib.rs
index f7439c75d1..f698648232 100644
--- a/tracing/src/lib.rs
+++ b/tracing/src/lib.rs
@@ -809,6 +809,7 @@
 //!  - [`tracing-logfmt`] provides a layer that formats events and spans into the logfmt format.
 //!  - [`reqwest-tracing`] provides a middleware to trace [`reqwest`] HTTP requests.
 //!  - [`tracing-cloudwatch`] provides a layer that sends events to AWS CloudWatch Logs.
+//!  - [`clippy-tracing`] provides a tool to add, remove and check for `tracing::instrument`.
 //!
 //! If you're the maintainer of a `tracing` ecosystem crate not listed above,
 //! please let us know! We'd love to add your project to the list!
@@ -850,6 +851,7 @@
 //! [`reqwest-tracing`]: https://crates.io/crates/reqwest-tracing
 //! [`reqwest`]: https://crates.io/crates/reqwest
 //! [`tracing-cloudwatch`]: https://crates.io/crates/tracing-cloudwatch
+//! [`clippy-tracing`]: https://crates.io/crates/clippy-tracing
 //!
 //! 
//!