Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify span traversal #1431

Merged
merged 33 commits into from Jun 22, 2021
Merged

Conversation

nightkr
Copy link
Contributor

@nightkr nightkr commented Jun 9, 2021

Motivation

Fixes #1429

Solution

Implemented as described in #1429, and migrated all internal uses of the deprecated methods. All tests passed both before and after the migration (9ec8130).

@nightkr nightkr requested review from hawkw, yaahc and a team as code owners June 9, 2021 22:43
@nightkr nightkr changed the title Feature/unified span iteration Unify span iteration Jun 9, 2021
tracing-flame/src/lib.rs Outdated Show resolved Hide resolved
tracing-journald/src/lib.rs Show resolved Hide resolved
tracing-journald/src/lib.rs Show resolved Hide resolved
Comment on lines +160 to +161
for span in ctx
.lookup_current()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nightkr nightkr changed the title Unify span iteration Unify span traversal Jun 10, 2021
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall, i'm in favor of this change. i think there are a few things i'd like to address before we move forward with it.

in particular:

  • let's make sure to do a version bump for tracing-subscriber and have all crates that depend on tracing-subscriber and use the new APIs update to require that version. otherwise, we could accidentally release a version of another crate that depends on APIs that aren't present in its minimum tracing-subscriber dependency
  • i'm not sure if removing Context::scope without a replacement is a great idea; i discussed that in more detail in a comment

Also, when this PR merges, it would be nice to port over the same change to tracing-subscriber 0.3 on the master branch --- we wouldn't want to accidentally revert this change in the breaking change release. We can also remove the deprecated methods on 0.3.

tracing-error/src/layer.rs Show resolved Hide resolved
tracing-flame/src/lib.rs Outdated Show resolved Hide resolved
tracing-flame/src/lib.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/layer.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/fmt/fmt_layer.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/layer.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Show resolved Hide resolved
tracing-subscriber/src/layer.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
@nightkr

This comment has been minimized.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall, this looks good to me. i left suggestions on some minor nitpicks in the deprecation notices, and a suggestion for improving the examples in the docs.

once those are addressed, i'll be happy to merge this.

tracing-subscriber/src/registry/mod.rs Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/fmt/fmt_layer.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/layer.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/layer.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
@nightkr
Copy link
Contributor Author

nightkr commented Jun 17, 2021

Good catch with the versions.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one last concern about the examples. once that's addressed, i think this is good to merge.

tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
Rather than keeping them merged with the doctests
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding the tests, this looks good to me! I had some minor suggestions for how we could potentially make the tests a little cleaner, but it's up to you whether it's worth making those changes --- i would happily merge this branch as it is now!

thanks for working on this!

tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
Comment on lines 486 to 489
let last_entered_scope = Arc::new(Mutex::new(Vec::new()));
#[derive(Default)]
struct PrintingLayer {
last_entered_scope: Arc<Mutex<Vec<&'static str>>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works and is fine, but an alternative way of writing these tests could just be to have the layer itself make the assertions. you could construct it with a VecDeque<Vec<&'static str>>, with the expected spans at each on_enter call in order, and every time on_enter is called, you could pop the front of the deque and assert that it matches what you get from collecting the iterator. this might be a bit simpler than sharing state between the layer and the rest of the test, but either approach is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would mean losing the Arc, which would be nice. On the other hand, I'm not a huge fan of the way that that decouples the action from the expected outcome.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, either way works fine --- it is nice to have the assertions made in the body of the test. i'm happy either way!

tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
tracing-subscriber/src/registry/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, this looks fantastic --- thanks @teozkr for sticking with this, i know it took a while to get through the review process, but i'm really happy about this change.

if you have the time, it would be nice to port these changes forwards to v0.3, on the master branch, as well --- we can simply remove all the deprecated APIs in the 0.3 version.

thanks again for working on this!

@hawkw hawkw merged commit 7a01260 into tokio-rs:v0.1.x Jun 22, 2021
nightkr added a commit to Appva/tracing that referenced this pull request Jun 24, 2021
Fixes tokio-rs#1429 (forwardport from v0.1.x branch)

Implemented as described in tokio-rs#1429, and migrated all internal uses of the
deprecated methods. All tests passed both before and after the migration
(9ec8130).

- Add a new method `SpanRef::scope(&self)` that returns a leaf-to-root
  `Iterator`, including the specified leaf
- Add a new method `Scope::from_root(self)` (where `Scope` is the type
  returned by `SpanRef::scope` defined earlier) that returns a
  root-to-leaf `Iterator` that ends at the current leaf (in other
  words: it's essentially the same as
  `Scope::collect::<Vec<_>>().into_iter().rev()`)
- Deprecate all existing iterators, since they can be replaced by the
  new unified mechanism:
  - `Span::parents` is equivalent to `Span::scope().skip(1)` (although
    the `skip` is typically a bug)
  - `Span::from_root` is equivalent to `Span::scope().skip(1).from_root()`
    (although the `skip` is typically a bug)
  - `Context::scope` is equivalent to
    `Context::lookup_current().scope().from_root()` (although the
    `lookup_current` is sometimes a bug, see also tokio-rs#1428)
hawkw pushed a commit that referenced this pull request Jun 24, 2021
Forward-port of #1431 and #1434

* subscriber: unify span traversal (#1431)

## Motivation

Fixes #1429 (forwardport from v0.1.x branch)

## Solution

Implemented as described in #1429, and migrated all internal uses of the
deprecated methods. All tests passed both before and after the migration
(9ec8130).

- Add a new method `SpanRef::scope(&self)` that returns a leaf-to-root
  `Iterator`, including the specified leaf
- Add a new method `Scope::from_root(self)` (where `Scope` is the type
  returned by `SpanRef::scope` defined earlier) that returns a
  root-to-leaf `Iterator` that ends at the current leaf (in other
  words: it's essentially the same as
  `Scope::collect::<Vec<_>>().into_iter().rev()`)
- Deprecate all existing iterators, since they can be replaced by the
  new unified mechanism:
  - `Span::parents` is equivalent to `Span::scope().skip(1)` (although
    the `skip` is typically a bug)
  - `Span::from_root` is equivalent to `Span::scope().skip(1).from_root()`
    (although the `skip` is typically a bug)
  - `Context::scope` is equivalent to
    `Context::lookup_current().scope().from_root()` (although the
    `lookup_current` is sometimes a bug, see also #1428)

* subscriber: add Context method for resolving an Event's SpanRef (#1434)

## Motivation

Fixes #1428 (forward-port from v0.1.x)

## Solution

Adds a new `Context::event_span` method as proposed in the issue.

No existing formatters were changed to use it yet, that seems like a
secondary issue (especially if they already work correctly).
hawkw added a commit that referenced this pull request Oct 22, 2021
## Motivation

`tracing-subscriber` currently contains some APIs that were deprecated
in the v0.2.x series:
- `fmt::LayerBuilder`, which is now a type alias for `fmt::Layer` (as
  the `Layer` type can expose all the same methods as the builder)
- `registry::SpanRef::parent_id`, which doesn't play nice with per-layer
  filtering,
- `fmt::Layer::inherit_fields`, which no longer does anything as it's
  now the default behavior
- `fmt::Layer::on_event`, which was renamed to `fmt_event`
- the `SpanRef::parents` and `layer::Context::scope` iterators, which
  were replaced by the APIs added in #1431 and #1434

Prior to releasing v0.3, the deprecated APIs should be removed.

## Solution

This branch deletes the deprecated APIs, with the exception of
`SpanRef::parents` and `Context::scope` (which were already removed in
240d11a).

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Oct 22, 2021
# 0.3.0 (Oct 22, 2021)

This is a breaking release of `tracing-subscriber`. The primary breaking
change in this release is the removal of the dependency on the [`chrono`
crate], due to [RUSTSEC-2020-0159]. To replace `chrono`, support is
added for formatting timestamps using the [`time` crate] instead.

In addition, this release includes a number of other breaking API
changes, such as adding (limited) support for `#![no_std]` targets,
removing previously deprecated APIs, and more.

### Breaking Changes

- Removed APIs deprecated in the v0.2.x release series.
- Renamed `Layer::new_span` to `Layer::on_new_span` ([#1674])
- Removed `Layer` impl for `Arc<L: Layer<S>>` and `Arc<dyn Layer<S> +
  ...>` ([#1649])
- Replaced the [`chrono` crate] with the [`time` crate] for timestamp
  formatting, to resolve [RUSTSEC-2020-0159] ([#1646])
- Removed `json` and `env-filter` from default features. They must now
  be enabled explictly ([#1647])
- Changed `FormatEvent::format_event` and `FormatFields::format_fields`
  trait methods to take a `Writer` type, rather than a `&mut dyn
  fmt::Write` trait object ([#1661])
- Changed the signature of the `MakeWriter` trait by adding a lifetime
  parameter ([#781])
  ### Changed

- **layer**: Renamed `Layer::new_span` to `Layer::on_new_span` ([#1674])
- **fmt**: Changed `FormatEvent::format_event` and
  `FormatFields::format_fields` trait methods to take a `Writer` type,
  rather than a `&mut dyn fmt::Write` trait object ([#1661])
- **json**, **env-filter**: `json` and `env-filter` feature flags are no
  longer enabled by default ([#1647])
  ### Removed

- Removed deprecated `CurrentSpan` type ([#1320])
- **registry**: Removed deprecated `SpanRef::parents` iterator, replaced
  by `SpanRef::scope` in [#1431] ([#1648)])
- **layer**: Removed deprecated `Context::scope` iterator, replaced by
  `Context::span_scope` and `Context::event_scope` in [#1431] and
  [#1434] ([#1648)])
- **layer**: Removed `Layer` impl for `Arc<L: Layer<S>>` and `Arc<dyn
  Layer<S> + ...>`. These interfere with per-layer filtering. ([#1649])
- **fmt**: Removed deprecated `LayerBuilder` type ([#1673])
- **fmt**: Removed `fmt::Layer::on_event` (renamed to
  `fmt::Layer::fmt_event`) ([#1673])
- **fmt**, **chrono**: Removed the `chrono` feature flag and APIs for
  using the [`chrono` crate] for timestamp formatting ([#1646])
  ### Added

- **fmt**, **time**: `LocalTime` and `UtcTime` types for formatting
  timestamps using the [`time` crate] ([#1646])
- **fmt**: Added a lifetime parameter to the `MakeWriter` trait,
  allowing it to return a borrowed writer. This enables implementations
  of `MakeWriter` for types such as `Mutex<T: io::Write>` and
  `std::fs::File`. ([#781])
- **env-filter**: Documentation improvements ([#1637])
- Support for some APIs on `#![no_std]` targets, by disabling the `std`
  feature flag ([#1660])

Thanks to @Folyd and @nmathewson for contributing to this release!

[#1320]: #1320
[#1673]: #1673
[#1674]: #1674
[#1646]: #1646
[#1647]: #1647
[#1648]: #1648
[#1649]: #1649
[#1660]: #1660
[#1661]: #1661
[#1431]: #1431
[#1434]: #1434
[#781]: #781

[`chrono` crate]: https://crates.io/crates/chrono
[`time` crate]: https://crates.io/crates/time
[RUSTSEC-2020-0159]: https://rustsec.org/advisories/RUSTSEC-2020-0159.html
hawkw added a commit that referenced this pull request Oct 22, 2021
# 0.3.0 (Oct 22, 2021)

This is a breaking release of `tracing-subscriber`. The primary breaking
change in this release is the removal of the dependency on the [`chrono`
crate], due to [RUSTSEC-2020-0159]. To replace `chrono`, support is
added for formatting timestamps using the [`time` crate] instead.

In addition, this release includes a number of other breaking API
changes, such as adding (limited) support for `#![no_std]` targets,
removing previously deprecated APIs, and more.

### Breaking Changes

- Removed APIs deprecated in the v0.2.x release series.
- Renamed `Layer::new_span` to `Layer::on_new_span` ([#1674])
- Removed `Layer` impl for `Arc<L: Layer<S>>` and `Arc<dyn Layer<S> +
  ...>` ([#1649])
- Replaced the [`chrono` crate] with the [`time` crate] for timestamp
  formatting, to resolve [RUSTSEC-2020-0159] ([#1646])
- Removed `json` and `env-filter` from default features. They must now
  be enabled explictly ([#1647])
- Changed `FormatEvent::format_event` and `FormatFields::format_fields`
  trait methods to take a `Writer` type, rather than a `&mut dyn
  fmt::Write` trait object ([#1661])
- Changed the signature of the `MakeWriter` trait by adding a lifetime
  parameter ([#781])
  ### Changed

- **layer**: Renamed `Layer::new_span` to `Layer::on_new_span` ([#1674])
- **fmt**: Changed `FormatEvent::format_event` and
  `FormatFields::format_fields` trait methods to take a `Writer` type,
  rather than a `&mut dyn fmt::Write` trait object ([#1661])
- **json**, **env-filter**: `json` and `env-filter` feature flags are no
  longer enabled by default ([#1647])
  ### Removed

- Removed deprecated `CurrentSpan` type ([#1320])
- **registry**: Removed deprecated `SpanRef::parents` iterator, replaced
  by `SpanRef::scope` in [#1431] ([#1648)])
- **layer**: Removed deprecated `Context::scope` iterator, replaced by
  `Context::span_scope` and `Context::event_scope` in [#1431] and
  [#1434] ([#1648)])
- **layer**: Removed `Layer` impl for `Arc<L: Layer<S>>` and `Arc<dyn
  Layer<S> + ...>`. These interfere with per-layer filtering. ([#1649])
- **fmt**: Removed deprecated `LayerBuilder` type ([#1673])
- **fmt**: Removed `fmt::Layer::on_event` (renamed to
  `fmt::Layer::fmt_event`) ([#1673])
- **fmt**, **chrono**: Removed the `chrono` feature flag and APIs for
  using the [`chrono` crate] for timestamp formatting ([#1646])
  ### Added

- **fmt**, **time**: `LocalTime` and `UtcTime` types for formatting
  timestamps using the [`time` crate] ([#1646])
- **fmt**: Added a lifetime parameter to the `MakeWriter` trait,
  allowing it to return a borrowed writer. This enables implementations
  of `MakeWriter` for types such as `Mutex<T: io::Write>` and
  `std::fs::File`. ([#781])
- **env-filter**: Documentation improvements ([#1637])
- Support for some APIs on `#![no_std]` targets, by disabling the `std`
  feature flag ([#1660])

Thanks to @Folyd and @nmathewson for contributing to this release!

[#1320]: #1320
[#1673]: #1673
[#1674]: #1674
[#1646]: #1646
[#1647]: #1647
[#1648]: #1648
[#1649]: #1649
[#1660]: #1660
[#1661]: #1661
[#1431]: #1431
[#1434]: #1434
[#781]: #781

[`chrono` crate]: https://crates.io/crates/chrono
[`time` crate]: https://crates.io/crates/time
[RUSTSEC-2020-0159]: https://rustsec.org/advisories/RUSTSEC-2020-0159.html

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
davidbarsky pushed a commit to tokio-rs/tracing-opentelemetry that referenced this pull request Mar 21, 2023
# 0.3.0 (Oct 22, 2021)

This is a breaking release of `tracing-subscriber`. The primary breaking
change in this release is the removal of the dependency on the [`chrono`
crate], due to [RUSTSEC-2020-0159]. To replace `chrono`, support is
added for formatting timestamps using the [`time` crate] instead.

In addition, this release includes a number of other breaking API
changes, such as adding (limited) support for `#![no_std]` targets,
removing previously deprecated APIs, and more.

### Breaking Changes

- Removed APIs deprecated in the v0.2.x release series.
- Renamed `Layer::new_span` to `Layer::on_new_span` ([#1674])
- Removed `Layer` impl for `Arc<L: Layer<S>>` and `Arc<dyn Layer<S> +
  ...>` ([#1649])
- Replaced the [`chrono` crate] with the [`time` crate] for timestamp
  formatting, to resolve [RUSTSEC-2020-0159] ([#1646])
- Removed `json` and `env-filter` from default features. They must now
  be enabled explictly ([#1647])
- Changed `FormatEvent::format_event` and `FormatFields::format_fields`
  trait methods to take a `Writer` type, rather than a `&mut dyn
  fmt::Write` trait object ([#1661])
- Changed the signature of the `MakeWriter` trait by adding a lifetime
  parameter ([#781])
  ### Changed

- **layer**: Renamed `Layer::new_span` to `Layer::on_new_span` ([#1674])
- **fmt**: Changed `FormatEvent::format_event` and
  `FormatFields::format_fields` trait methods to take a `Writer` type,
  rather than a `&mut dyn fmt::Write` trait object ([#1661])
- **json**, **env-filter**: `json` and `env-filter` feature flags are no
  longer enabled by default ([#1647])
  ### Removed

- Removed deprecated `CurrentSpan` type ([#1320])
- **registry**: Removed deprecated `SpanRef::parents` iterator, replaced
  by `SpanRef::scope` in [#1431] ([#1648)])
- **layer**: Removed deprecated `Context::scope` iterator, replaced by
  `Context::span_scope` and `Context::event_scope` in [#1431] and
  [#1434] ([#1648)])
- **layer**: Removed `Layer` impl for `Arc<L: Layer<S>>` and `Arc<dyn
  Layer<S> + ...>`. These interfere with per-layer filtering. ([#1649])
- **fmt**: Removed deprecated `LayerBuilder` type ([#1673])
- **fmt**: Removed `fmt::Layer::on_event` (renamed to
  `fmt::Layer::fmt_event`) ([#1673])
- **fmt**, **chrono**: Removed the `chrono` feature flag and APIs for
  using the [`chrono` crate] for timestamp formatting ([#1646])
  ### Added

- **fmt**, **time**: `LocalTime` and `UtcTime` types for formatting
  timestamps using the [`time` crate] ([#1646])
- **fmt**: Added a lifetime parameter to the `MakeWriter` trait,
  allowing it to return a borrowed writer. This enables implementations
  of `MakeWriter` for types such as `Mutex<T: io::Write>` and
  `std::fs::File`. ([#781])
- **env-filter**: Documentation improvements ([#1637])
- Support for some APIs on `#![no_std]` targets, by disabling the `std`
  feature flag ([#1660])

Thanks to @Folyd and @nmathewson for contributing to this release!

[#1320]: tokio-rs/tracing#1320
[#1673]: tokio-rs/tracing#1673
[#1674]: tokio-rs/tracing#1674
[#1646]: tokio-rs/tracing#1646
[#1647]: tokio-rs/tracing#1647
[#1648]: tokio-rs/tracing#1648
[#1649]: tokio-rs/tracing#1649
[#1660]: tokio-rs/tracing#1660
[#1661]: tokio-rs/tracing#1661
[#1431]: tokio-rs/tracing#1431
[#1434]: tokio-rs/tracing#1434
[#781]: tokio-rs/tracing#781

[`chrono` crate]: https://crates.io/crates/chrono
[`time` crate]: https://crates.io/crates/time
[RUSTSEC-2020-0159]: https://rustsec.org/advisories/RUSTSEC-2020-0159.html

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
## Motivation

Fixes tokio-rs#1429 

## Solution

Implemented as described in tokio-rs#1429, and migrated all internal uses of the
deprecated methods. All tests passed both before and after the migration
(9ec8130).

- Add a new method `SpanRef::scope(&self)` that returns a leaf-to-root
  `Iterator`, including the specified leaf
- Add a new method `Scope::from_root(self)` (where `Scope` is the type
  returned by `SpanRef::scope` defined earlier) that returns a
  root-to-leaf `Iterator` that ends at the current leaf (in other
  words: it's essentially the same as
  `Scope::collect::<Vec<_>>().into_iter().rev()`)
- Deprecate all existing iterators, since they can be replaced by the
  new unified mechanism:
  - `Span::parents` is equivalent to `Span::scope().skip(1)` (although
    the `skip` is typically a bug)
  - `Span::from_root` is equivalent to `Span::scope().skip(1).from_root()`
    (although the `skip` is typically a bug)
  - `Context::scope` is equivalent to
    `Context::lookup_current().scope().from_root()` (although the
    `lookup_current` is sometimes a bug, see also tokio-rs#1428)
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
## Motivation

`tracing-subscriber` currently contains some APIs that were deprecated
in the v0.2.x series:
- `fmt::LayerBuilder`, which is now a type alias for `fmt::Layer` (as
  the `Layer` type can expose all the same methods as the builder)
- `registry::SpanRef::parent_id`, which doesn't play nice with per-layer
  filtering,
- `fmt::Layer::inherit_fields`, which no longer does anything as it's
  now the default behavior
- `fmt::Layer::on_event`, which was renamed to `fmt_event`
- the `SpanRef::parents` and `layer::Context::scope` iterators, which
  were replaced by the APIs added in tokio-rs#1431 and tokio-rs#1434

Prior to releasing v0.3, the deprecated APIs should be removed.

## Solution

This branch deletes the deprecated APIs, with the exception of
`SpanRef::parents` and `Context::scope` (which were already removed in
240d11a).

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
# 0.3.0 (Oct 22, 2021)

This is a breaking release of `tracing-subscriber`. The primary breaking
change in this release is the removal of the dependency on the [`chrono`
crate], due to [RUSTSEC-2020-0159]. To replace `chrono`, support is
added for formatting timestamps using the [`time` crate] instead.

In addition, this release includes a number of other breaking API
changes, such as adding (limited) support for `#![no_std]` targets,
removing previously deprecated APIs, and more.

### Breaking Changes

- Removed APIs deprecated in the v0.2.x release series.
- Renamed `Layer::new_span` to `Layer::on_new_span` ([tokio-rs#1674])
- Removed `Layer` impl for `Arc<L: Layer<S>>` and `Arc<dyn Layer<S> +
  ...>` ([tokio-rs#1649])
- Replaced the [`chrono` crate] with the [`time` crate] for timestamp
  formatting, to resolve [RUSTSEC-2020-0159] ([tokio-rs#1646])
- Removed `json` and `env-filter` from default features. They must now
  be enabled explictly ([tokio-rs#1647])
- Changed `FormatEvent::format_event` and `FormatFields::format_fields`
  trait methods to take a `Writer` type, rather than a `&mut dyn
  fmt::Write` trait object ([tokio-rs#1661])
- Changed the signature of the `MakeWriter` trait by adding a lifetime
  parameter ([tokio-rs#781])
  ### Changed

- **layer**: Renamed `Layer::new_span` to `Layer::on_new_span` ([tokio-rs#1674])
- **fmt**: Changed `FormatEvent::format_event` and
  `FormatFields::format_fields` trait methods to take a `Writer` type,
  rather than a `&mut dyn fmt::Write` trait object ([tokio-rs#1661])
- **json**, **env-filter**: `json` and `env-filter` feature flags are no
  longer enabled by default ([tokio-rs#1647])
  ### Removed

- Removed deprecated `CurrentSpan` type ([tokio-rs#1320])
- **registry**: Removed deprecated `SpanRef::parents` iterator, replaced
  by `SpanRef::scope` in [tokio-rs#1431] ([tokio-rs#1648)])
- **layer**: Removed deprecated `Context::scope` iterator, replaced by
  `Context::span_scope` and `Context::event_scope` in [tokio-rs#1431] and
  [tokio-rs#1434] ([tokio-rs#1648)])
- **layer**: Removed `Layer` impl for `Arc<L: Layer<S>>` and `Arc<dyn
  Layer<S> + ...>`. These interfere with per-layer filtering. ([tokio-rs#1649])
- **fmt**: Removed deprecated `LayerBuilder` type ([tokio-rs#1673])
- **fmt**: Removed `fmt::Layer::on_event` (renamed to
  `fmt::Layer::fmt_event`) ([tokio-rs#1673])
- **fmt**, **chrono**: Removed the `chrono` feature flag and APIs for
  using the [`chrono` crate] for timestamp formatting ([tokio-rs#1646])
  ### Added

- **fmt**, **time**: `LocalTime` and `UtcTime` types for formatting
  timestamps using the [`time` crate] ([tokio-rs#1646])
- **fmt**: Added a lifetime parameter to the `MakeWriter` trait,
  allowing it to return a borrowed writer. This enables implementations
  of `MakeWriter` for types such as `Mutex<T: io::Write>` and
  `std::fs::File`. ([tokio-rs#781])
- **env-filter**: Documentation improvements ([tokio-rs#1637])
- Support for some APIs on `#![no_std]` targets, by disabling the `std`
  feature flag ([tokio-rs#1660])

Thanks to @Folyd and @nmathewson for contributing to this release!

[tokio-rs#1320]: tokio-rs#1320
[tokio-rs#1673]: tokio-rs#1673
[tokio-rs#1674]: tokio-rs#1674
[tokio-rs#1646]: tokio-rs#1646
[tokio-rs#1647]: tokio-rs#1647
[tokio-rs#1648]: tokio-rs#1648
[tokio-rs#1649]: tokio-rs#1649
[tokio-rs#1660]: tokio-rs#1660
[tokio-rs#1661]: tokio-rs#1661
[tokio-rs#1431]: tokio-rs#1431
[tokio-rs#1434]: tokio-rs#1434
[tokio-rs#781]: tokio-rs#781

[`chrono` crate]: https://crates.io/crates/chrono
[`time` crate]: https://crates.io/crates/time
[RUSTSEC-2020-0159]: https://rustsec.org/advisories/RUSTSEC-2020-0159.html

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants