Skip to content

Commit

Permalink
Merge branch 'master' into instrument-tracing-override
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamschi authored Dec 12, 2024
2 parents 72bc05c + b02a700 commit bc1789c
Show file tree
Hide file tree
Showing 39 changed files with 123 additions and 131 deletions.
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ be viewed by clicking the `details` link on the
### Building Documentation

Tracing's documentation uses nightly-only RustDoc features and lints, like
`doc(cfg)` and `broken_intra_doc_lints`. These features are enabled by
`doc(cfg)` and `broken_intra_doc_lints`. These features are enabled by
passing `--cfg docsrs` to RustDoc. Therefore, in order to build Tracing's
documentation the same way it would be built by docs.rs, it's necessary to
use the following command:
Expand Down Expand Up @@ -430,8 +430,7 @@ When releasing a new version of a crate, follow these steps:
2. **Update Cargo metadata.** After releasing any path dependencies, update the
`version` field in `Cargo.toml` to the new version, and the `documentation`
field to the docs.rs URL of the new version.
3. **Update other documentation links.** Update the `#![doc(html_root_url)]`
attribute in the crate's `lib.rs` and the "Documentation" link in the crate's
3. **Update the "Documentation" link in the crate's
`README.md` to point to the docs.rs URL of the new version.
4. **Update the changelog for the crate.** Each crate in the Tokio repository
has its own `CHANGELOG.md` in that crate's subdirectory. Any changes to that
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[docs-badge]: https://docs.rs/tracing/badge.svg
[docs-url]: https://docs.rs/tracing
[docs-master-badge]: https://img.shields.io/badge/docs-master-blue
[docs-master-url]: https://tracing-rs.netlify.com
[docs-master-url]: https://tracing.rs
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[mit-url]: LICENSE
[actions-badge]: https://github.com/tokio-rs/tracing/workflows/CI/badge.svg
Expand Down Expand Up @@ -477,6 +477,7 @@ Tracing.
* [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
* [Decrusting the tracing crate by Jon Gjengset][decrusting-tracing-2024-02], February 2024

[bay-rust-2019-03]: https://www.youtube.com/watch?v=j_kXRg3zlec
[rust-conf-2019-08-video]: https://www.youtube.com/watch?v=JjItsfqFIdo
Expand All @@ -487,6 +488,7 @@ Tracing.
[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
[decrusting-tracing-2024-02]: https://www.youtube.com/watch?v=21rtHinFA40

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.
Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ This directory contains a collection of examples that demonstrate the use of the
+ `futures-proxy-server`: Demonstrates the use of `tracing-futures` by
implementing a simple proxy server, based on [this example][tokio-proxy]
from `tokio`.
+ `async_fn`: Demonstrates how asynchronous functions can be
+ `async-fn`: Demonstrates how asynchronous functions can be
instrumented.
+ `echo`: Demonstrates a `tracing`-instrumented variant of Tokio's `echo` example.
- **tracing-flame**:
+ `infero-flame`: Demonstrates the use of `tracing-flame` to generate a flamegraph
+ `inferno-flame`: Demonstrates the use of `tracing-flame` to generate a flamegraph
from spans.
- **tracing-tower**:
+ `tower-client`: Demonstrates the use of `tracing-tower` to instrument a
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct Count<'a> {
counters: RwLockReadGuard<'a, HashMap<String, AtomicUsize>>,
}

impl<'a> Visit for Count<'a> {
impl Visit for Count<'_> {
fn record_i64(&mut self, field: &Field, value: i64) {
if let Some(counter) = self.counters.get(field.name()) {
if value > 0 {
Expand Down
4 changes: 2 additions & 2 deletions examples/examples/sloggish/sloggish_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct Event<'a> {

struct ColorLevel<'a>(&'a Level);

impl<'a> fmt::Display for ColorLevel<'a> {
impl fmt::Display for ColorLevel<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self.0 {
Level::TRACE => Color::Purple.paint("TRACE"),
Expand Down Expand Up @@ -109,7 +109,7 @@ impl Visit for Span {
}
}

impl<'a> Visit for Event<'a> {
impl Visit for Event<'_> {
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
write!(
&mut self.stderr,
Expand Down
2 changes: 1 addition & 1 deletion tracing-appender/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl NoOpWriter {
}
}

impl<'a> MakeWriter<'a> for NoOpWriter {
impl MakeWriter<'_> for NoOpWriter {
type Writer = NoOpWriter;

fn make_writer(&self) -> Self::Writer {
Expand Down
2 changes: 1 addition & 1 deletion tracing-appender/src/rolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub use builder::{Builder, InitError};
///
/// // Log all events to a rolling log file.
/// let logfile = tracing_appender::rolling::hourly("/logs", "myapp-logs");
///
/// // Log `INFO` and above to stdout.
/// let stdout = std::io::stdout.with_max_level(tracing::Level::INFO);
///
Expand Down
5 changes: 1 addition & 4 deletions tracing-attributes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
name = "tracing-attributes"
# When releasing to crates.io:
# - Remove path dependencies
# - Update html_root_url.
# - Update doc url
# - Cargo.toml
# - README.md
# - Update doc url in README.md.
# - Update CHANGELOG.md.
# - Create "v0.2.x" git tag.
version = "0.2.0"
Expand Down
4 changes: 2 additions & 2 deletions tracing-attributes/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ struct IdentAndTypesRenamer<'a> {
idents: Vec<(Ident, Ident)>,
}

impl<'a> VisitMut for IdentAndTypesRenamer<'a> {
impl VisitMut for IdentAndTypesRenamer<'_> {
// we deliberately compare strings because we want to ignore the spans
// If we apply clippy's lint, the behavior changes
#[allow(clippy::cmp_owned)]
Expand Down Expand Up @@ -803,7 +803,7 @@ struct AsyncTraitBlockReplacer<'a> {
patched_block: Block,
}

impl<'a> VisitMut for AsyncTraitBlockReplacer<'a> {
impl VisitMut for AsyncTraitBlockReplacer<'_> {
fn visit_block_mut(&mut self, i: &mut Block) {
if i == self.block {
*i = self.patched_block.clone();
Expand Down
4 changes: 1 addition & 3 deletions tracing-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name = "tracing-core"
# When releasing to crates.io:
# - Remove path dependencies
# - Update html_root_url.
# - Update doc url
# - Cargo.toml
# - README.md
# - Update doc url in README.md.
# - Update CHANGELOG.md.
# - Create "v0.2.x" git tag.
version = "0.2.0"
Expand Down
4 changes: 2 additions & 2 deletions tracing-core/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ where
// the default dispatcher will not be able to access the dispatch context.
// Dropping the guard will allow the dispatch context to be re-entered.
struct Entered<'a>(&'a Cell<bool>);
impl<'a> Drop for Entered<'a> {
impl Drop for Entered<'_> {
#[inline]
fn drop(&mut self) {
self.0.set(true);
Expand Down Expand Up @@ -1039,7 +1039,7 @@ impl<'a> Entered<'a> {
}

#[cfg(feature = "std")]
impl<'a> Drop for Entered<'a> {
impl Drop for Entered<'_> {
#[inline]
fn drop(&mut self) {
self.0.can_enter.set(true);
Expand Down
18 changes: 9 additions & 9 deletions tracing-core/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ where

struct HexBytes<'a>(&'a [u8]);

impl<'a> fmt::Debug for HexBytes<'a> {
impl fmt::Debug for HexBytes<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_char('[')?;

Expand All @@ -310,13 +310,13 @@ impl<'a> fmt::Debug for HexBytes<'a> {

// ===== impl Visit =====

impl<'a, 'b> Visit for fmt::DebugStruct<'a, 'b> {
impl Visit for fmt::DebugStruct<'_, '_> {
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
self.field(field.name(), value);
}
}

impl<'a, 'b> Visit for fmt::DebugMap<'a, 'b> {
impl Visit for fmt::DebugMap<'_, '_> {
fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) {
self.entry(&format_args!("{}", field), value);
}
Expand Down Expand Up @@ -544,9 +544,9 @@ where
}
}

impl<'a> crate::sealed::Sealed for fmt::Arguments<'a> {}
impl crate::sealed::Sealed for fmt::Arguments<'_> {}

impl<'a> Value for fmt::Arguments<'a> {
impl Value for fmt::Arguments<'_> {
fn record(&self, key: &Field, visitor: &mut dyn Visit) {
visitor.record_debug(key, self)
}
Expand Down Expand Up @@ -818,7 +818,7 @@ impl FieldSet {
}
}

impl<'a> IntoIterator for &'a FieldSet {
impl IntoIterator for &FieldSet {
type IntoIter = Iter;
type Item = Field;
#[inline]
Expand Down Expand Up @@ -897,7 +897,7 @@ impl Iterator for Iter {

// ===== impl ValueSet =====

impl<'a> ValueSet<'a> {
impl ValueSet<'_> {
/// Returns an [`Identifier`] that uniquely identifies the [`Callsite`]
/// defining the fields this `ValueSet` refers to.
///
Expand Down Expand Up @@ -958,7 +958,7 @@ impl<'a> ValueSet<'a> {
}
}

impl<'a> fmt::Debug for ValueSet<'a> {
impl fmt::Debug for ValueSet<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.values
.iter()
Expand All @@ -973,7 +973,7 @@ impl<'a> fmt::Debug for ValueSet<'a> {
}
}

impl<'a> fmt::Display for ValueSet<'a> {
impl fmt::Display for ValueSet<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.values
.iter()
Expand Down
8 changes: 4 additions & 4 deletions tracing-core/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub struct Kind(u8);
/// // ...
/// # drop(span); Id::from_u64(1)
/// }
///
/// fn event(&self, event: &Event<'_>) {
/// // ...
/// # drop(event);
Expand Down Expand Up @@ -333,7 +333,7 @@ impl<'a> Metadata<'a> {
}
}

impl<'a> fmt::Debug for Metadata<'a> {
impl fmt::Debug for Metadata<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut meta = f.debug_struct("Metadata");
meta.field("name", &self.name)
Expand Down Expand Up @@ -441,9 +441,9 @@ impl fmt::Debug for Kind {
}
}

impl<'a> Eq for Metadata<'a> {}
impl Eq for Metadata<'_> {}

impl<'a> PartialEq for Metadata<'a> {
impl PartialEq for Metadata<'_> {
#[inline]
fn eq(&self, other: &Self) -> bool {
if core::ptr::eq(&self, &other) {
Expand Down
5 changes: 1 addition & 4 deletions tracing-error/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
name = "tracing-error"
# When releasing to crates.io:
# - Remove path dependencies
# - Update html_root_url.
# - Update doc url
# - Cargo.toml
# - README.md
# - Update doc url in README.md.
# - Update CHANGELOG.md.
# - Create "v0.2.x" git tag
version = "0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion tracing-error/src/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl fmt::Debug for SpanTrace {
fields: &'a str,
}

impl<'a> fmt::Debug for DebugSpan<'a> {
impl fmt::Debug for DebugSpan<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
Expand Down
9 changes: 4 additions & 5 deletions tracing-futures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
//! This crate provides a number of feature flags that enable compatibility
//! features with other crates in the asynchronous ecosystem:
//!
//! - `tokio`: Enables compatibility with the `tokio` crate, including
//! - `tokio`: Enables compatibility with the `tokio` 0.1 crate, including
//! [`Instrument`] and [`WithCollector`] implementations for
//! `tokio::executor::Executor`, `tokio::runtime::Runtime`, and
//! `tokio::runtime::current_thread`. Enabled by default.
//! `tokio::runtime::current_thread`. This is not needed for compatibility
//! with `tokio` v1.
//! - `tokio-executor`: Enables compatibility with the `tokio-executor`
//! crate, including [`Instrument`] and [`WithCollector`]
//! implementations for types implementing `tokio_executor::Executor`.
Expand All @@ -39,8 +40,6 @@
//! crate.
//! - `futures-03`: Enables compatibility with version 0.3.x of the `futures`
//! crate's `Spawn` and `LocalSpawn` traits.
//! - `tokio-alpha`: Enables compatibility with `tokio` 0.2's alpha releases,
//! including the `tokio` 0.2 `Executor` and `TypedExecutor` traits.
//! - `std`: Depend on the Rust standard library.
//!
//! `no_std` users may disable this feature with `default-features = false`:
Expand All @@ -50,7 +49,7 @@
//! tracing-futures = { version = "0.2.3", default-features = false }
//! ```
//!
//! The `tokio`, `std-future` and `std` features are enabled by default.
//! The `std-future` and `std` features are enabled by default.
//!
//! [`tracing`]: https://crates.io/crates/tracing
//! [span]: mod@tracing::span
Expand Down
10 changes: 5 additions & 5 deletions tracing-log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub trait AsTrace: crate::sealed::Sealed {
fn as_trace(&self) -> Self::Trace;
}

impl<'a> crate::sealed::Sealed for Metadata<'a> {}
impl crate::sealed::Sealed for Metadata<'_> {}

impl<'a> AsLog for Metadata<'a> {
type Log = log::Metadata<'a>;
Expand All @@ -220,7 +220,7 @@ impl<'a> AsLog for Metadata<'a> {
.build()
}
}
impl<'a> crate::sealed::Sealed for log::Metadata<'a> {}
impl crate::sealed::Sealed for log::Metadata<'_> {}

impl<'a> AsTrace for log::Metadata<'a> {
type Trace = Metadata<'a>;
Expand Down Expand Up @@ -350,7 +350,7 @@ fn loglevel_to_cs(
}
}

impl<'a> crate::sealed::Sealed for log::Record<'a> {}
impl crate::sealed::Sealed for log::Record<'_> {}

impl<'a> AsTrace for log::Record<'a> {
type Trace = Metadata<'a>;
Expand Down Expand Up @@ -461,7 +461,7 @@ pub trait NormalizeEvent<'a>: crate::sealed::Sealed {
fn is_log(&self) -> bool;
}

impl<'a> crate::sealed::Sealed for Event<'a> {}
impl crate::sealed::Sealed for Event<'_> {}

impl<'a> NormalizeEvent<'a> for Event<'a> {
fn normalized_metadata(&'a self) -> Option<Metadata<'a>> {
Expand Down Expand Up @@ -513,7 +513,7 @@ impl<'a> LogVisitor<'a> {
}
}

impl<'a> Visit for LogVisitor<'a> {
impl Visit for LogVisitor<'_> {
fn record_debug(&mut self, _field: &Field, _value: &dyn fmt::Debug) {}

fn record_u64(&mut self, field: &Field, value: u64) {
Expand Down
4 changes: 2 additions & 2 deletions tracing-mock/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ pub(crate) struct CheckVisitor<'a> {
collector_name: &'a str,
}

impl<'a> Visit for CheckVisitor<'a> {
impl Visit for CheckVisitor<'_> {
fn record_f64(&mut self, field: &Field, value: f64) {
self.expect
.compare_or_panic(field.name(), &value, self.ctx, self.collector_name)
Expand Down Expand Up @@ -557,7 +557,7 @@ impl<'a> Visit for CheckVisitor<'a> {
}
}

impl<'a> CheckVisitor<'a> {
impl CheckVisitor<'_> {
pub(crate) fn finish(self) {
assert!(
self.expect.fields.is_empty(),
Expand Down
Loading

0 comments on commit bc1789c

Please sign in to comment.