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

backport a gigantic pile of stuff #2570

Merged
merged 28 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7c09e57
chore: allow renamed and removed lints on docs build (#2344)
hawkw Oct 10, 2022
81f94fe
subscriber: impl `fmt::Display` for `filter::Targets` (#2343)
hawkw Oct 10, 2022
528e633
attributes: support custom levels for `ret` and `err` (#2335)
nitnelave Oct 10, 2022
8cc41bf
attributes: improve docs; tests for using Levels in `#[instrument]` (…
jsgf Oct 27, 2022
17c1c64
chore: track Rust 1.65 clippy lints (#2366)
hawkw Nov 4, 2022
b7c5609
subscriber: fix wrong `doc_cfg` attribute (#2368)
hawkw Nov 4, 2022
018ded8
appender: allow worker thread name to be configured (#2365)
nstinus Nov 4, 2022
099f133
attributes: allow `clippy::unreachable` warning (#2356)
Abhicodes-crypto Nov 4, 2022
f0242bd
appender: Fix typo in RollingFileAppender docs (#2375)
yotamofek Nov 10, 2022
40b576f
fix(docs): Remove accidentally duplicated words (#2378)
LeoniePhiline Nov 11, 2022
ac8ddf4
chore: Remove `doc(html_root_url)` attribute from all crates. (#2384)
LukeMathWalker Nov 16, 2022
38c1d8b
subscriber: dim `Compact` targets, matching the default formatter (#2…
howardjohn Dec 8, 2022
191cdc5
attributes: add compile error on const fn instrumentation (#2418)
andrewpollack Dec 31, 2022
0328b5f
chore: fix new clippy lints from 1.67.0 (#2451)
hds Jan 28, 2023
59d9ae3
attributes: document default level for `err` (#2433)
quad Feb 8, 2023
c71fb14
chore: move tracing-opentelemetry to its own repo (#2523)
davidbarsky Apr 4, 2023
0192304
subscriber: dim `Compact` targets, matching the default formatter (#2…
davidbarsky Apr 5, 2023
fd17727
chore: fix `clippy::needless_borrow` lint in journald tests (#2547)
hawkw Apr 5, 2023
334bee7
tracing: `inline` methods to make macro-generated code smaller (#2555)
ldm0 Apr 11, 2023
b5f6317
Remove dep `cfg-if` from tracing (#2553)
NobodyXu Apr 12, 2023
6feda04
attributes: remove unused syn's feature visit (#2530)
klensy Apr 13, 2023
83cc0b0
attributes: update to syn 2.0 (#2516)
davidpdrsn Apr 13, 2023
192921c
subscriber: add ability to disable ANSI without crate feature (#2532)
daxpedda Apr 14, 2023
f079c81
mock: move layer mock from tracing-subscriber tests (#2369)
hawkw Apr 21, 2023
6b60a04
tracing, tracing-futures: instrument `Future` inside `Drop` (#2562)
ilslv Apr 18, 2023
a6326ef
attributes: update UI tests with the latest stable version of Rust (#…
dbidwell94 Apr 21, 2023
f1c188f
subscriber: add "unicode-case" and "unicode-perl" features to `regex`…
dbidwell94 Apr 21, 2023
2575f20
chore: fix rustfmt
hawkw Apr 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
# David contributed the Registry implementation.
/tracing-subscriber/registry @davidbarsky @hawkw @tokio-rs/tracing

# Julian contributed the OpenTelemetry implementation.
/tracing-opentelemetry/ @jtescher @tokio-rs/tracing

# Zeki contributed the TracingAppender implementation
/tracing-appender/ @zekisherif @tokio-rs/tracing
29 changes: 5 additions & 24 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,11 @@ jobs:
- tracing-macros
- tracing-serde
- tracing-tower
- tracing-opentelemetry
- tracing
- tracing-subscriber
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- uses: dtolnay/rust-toolchain@stable
- name: install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: cargo hack check
Expand Down Expand Up @@ -175,8 +169,9 @@ jobs:
shell: bash

check-msrv:
# Run `cargo check` on our minimum supported Rust version (1.49.0).
name: "cargo check (MSRV on ubuntu-latest)"
# Run `cargo check` on our minimum supported Rust version (1.56.0). This
# checks with minimal versions; maximal versions are checked above.
name: "cargo check (+MSRV -Zminimal-versions)"
needs: check
runs-on: ubuntu-latest
strategy:
Expand All @@ -194,23 +189,10 @@ jobs:
- tracing-serde
- tracing-subscriber
- tracing-tower
- tracing-opentelemetry
- tracing
toolchain:
- 1.49.0
- 1.56.0
- stable
# TODO(eliza): remove this when appender is on the same MSRV.
# same for tracing subscriber
exclude:
- subcrate: tracing-appender
toolchain: 1.49.0
- subcrate: tracing-subscriber
toolchain: 1.49.0
include:
- subcrate: tracing-appender
toolchain: 1.53.0
- subcrate: tracing-subscriber
toolchain: 1.50.0
steps:
- uses: actions/checkout@v3
- name: "install Rust ${{ env.APPENDER_MSRV }}"
Expand Down Expand Up @@ -295,7 +277,6 @@ jobs:
- tracing-journald
- tracing-log
- tracing-macros
- tracing-opentelemetry
- tracing-serde
- tracing-subscriber
- tracing-tower
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ members = [
"tracing-log",
"tracing-macros",
"tracing-mock",
"tracing-opentelemetry",
"tracing-subscriber",
"tracing-serde",
"tracing-appender",
Expand Down
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ attachment that `Future::instrument` does.
## Supported Rust Versions

Tracing is built against the latest stable release. The minimum supported
version is 1.49. The current Tracing version is not guaranteed to build on Rust
version is 1.56. 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.45, the minimum supported version will not be increased
past 1.42, three minor versions prior. Increasing the minimum supported compiler
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.

Expand Down Expand Up @@ -305,11 +305,6 @@ The crates included as part of Tracing are:

* [`tracing-log`]: Compatibility with the `log` crate (unstable).

* [`tracing-opentelemetry`]: Provides a layer that connects spans from multiple
systems into a trace and emits them to [OpenTelemetry]-compatible distributed
tracing systems for processing and visualization.
([crates.io][otel-crates]|[docs][otel-docs])

* [`tracing-serde`]: A compatibility layer for serializing trace data with
`serde` (unstable).

Expand Down Expand Up @@ -337,7 +332,6 @@ The crates included as part of Tracing are:
[`tracing-macros`]: tracing-macros
[`tracing-attributes`]: tracing-attributes
[`tracing-log`]: tracing-log
[`tracing-opentelemetry`]: tracing-opentelemetry
[`tracing-serde`]: tracing-serde
[`tracing-subscriber`]: tracing-subscriber
[`tracing-tower`]: tracing-tower
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
blacklisted-names = []
disallowed-names = []
cognitive-complexity-threshold = 100
too-many-arguments-threshold = 8
type-complexity-threshold = 375
9 changes: 2 additions & 7 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tracing-examples"
version = "0.0.0"
publish = false
edition = "2018"
rust-version = "1.49.0"
rust-version = "1.56.0"

[features]
default = []
Expand All @@ -21,9 +21,8 @@ tracing-futures = { version = "0.2.1", path = "../tracing-futures", features = [
tracing-attributes = { path = "../tracing-attributes", version = "0.1.22" }
tracing-log = { path = "../tracing-log", version = "0.1.3", features = ["env_logger"] }
tracing-serde = { path = "../tracing-serde" }
tracing-opentelemetry = { path = "../tracing-opentelemetry" }
tracing-journald = { path = "../tracing-journald" }
tracing-appender = { path = "../tracing-appender", version = "0.2.0" }
tracing-journald = { path = "../tracing-journald" }

# serde example
serde_json = "1.0.82"
Expand Down Expand Up @@ -51,10 +50,6 @@ log = "0.4.17"
inferno = "0.11.6"
tempfile = "3"

# opentelemetry example
opentelemetry = { version = "0.18.0", default-features = false, features = ["trace"] }
opentelemetry-jaeger = "0.17.0"

# fmt examples
snafu = "0.6.10"
thiserror = "1.0.31"
Expand Down
6 changes: 0 additions & 6 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ This directory contains a collection of examples that demonstrate the use of the
unstructured logs from dependencies as `tracing` events, by instrumenting
[this example][echo] from `hyper`, and using `tracing-log` to record logs
emitted by `hyper`.
- **tracing-opentelemetry**:
+ `opentelemetry`: Demonstrates how `tracing-opentelemetry` can be used to
export and visualize `tracing` span data.
+ `opentelemetry-remote-context`: Demonstrates how `tracing-opentelemetry`
can be used to extract and inject remote context when traces span multiple
systems.

[tasks]: (https://docs.rs/tokio/0.2.21/tokio/task/index.html)
[tokio-proxy]: https://github.com/tokio-rs/tokio/blob/v0.1.x/tokio/examples/proxy.rs
Expand Down
46 changes: 0 additions & 46 deletions examples/examples/opentelemetry-remote-context.rs

This file was deleted.

49 changes: 0 additions & 49 deletions examples/examples/opentelemetry.rs

This file was deleted.

1 change: 1 addition & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[build.environment]
RUSTDOCFLAGS="""
-D warnings \
--force-warn renamed-and-removed-lints \
--cfg docsrs \
--cfg tracing_unstable
"""
Expand Down
4 changes: 2 additions & 2 deletions tracing-appender/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ 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.45, the minimum supported version will not be
increased past 1.42, three minor versions prior. Increasing the minimum
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.

Expand Down
5 changes: 2 additions & 3 deletions tracing-appender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@
//! 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.45, the minimum supported version will not be
//! increased past 1.42, three minor versions prior. Increasing the minimum
//! 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.
//!
#![doc(html_root_url = "https://docs.rs/tracing-appender/0.2.2")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/master/assets/logo-type.png",
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
Expand Down
25 changes: 22 additions & 3 deletions tracing-appender/src/non_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,18 @@ impl NonBlocking {
writer: T,
buffered_lines_limit: usize,
is_lossy: bool,
thread_name: String,
) -> (NonBlocking, WorkerGuard) {
let (sender, receiver) = bounded(buffered_lines_limit);

let (shutdown_sender, shutdown_receiver) = bounded(0);

let worker = Worker::new(receiver, writer, shutdown_receiver);
let worker_guard =
WorkerGuard::new(worker.worker_thread(), sender.clone(), shutdown_sender);
let worker_guard = WorkerGuard::new(
worker.worker_thread(thread_name),
sender.clone(),
shutdown_sender,
);

(
Self {
Expand All @@ -187,6 +191,7 @@ impl NonBlocking {
pub struct NonBlockingBuilder {
buffered_lines_limit: usize,
is_lossy: bool,
thread_name: String,
}

impl NonBlockingBuilder {
Expand All @@ -207,9 +212,22 @@ impl NonBlockingBuilder {
self
}

/// Override the worker thread's name.
///
/// The default worker thread name is "tracing-appender".
pub fn thread_name(mut self, name: &str) -> NonBlockingBuilder {
self.thread_name = name.to_string();
self
}

/// Completes the builder, returning the configured `NonBlocking`.
pub fn finish<T: Write + Send + Sync + 'static>(self, writer: T) -> (NonBlocking, WorkerGuard) {
NonBlocking::create(writer, self.buffered_lines_limit, self.is_lossy)
NonBlocking::create(
writer,
self.buffered_lines_limit,
self.is_lossy,
self.thread_name,
)
}
}

Expand All @@ -218,6 +236,7 @@ impl Default for NonBlockingBuilder {
NonBlockingBuilder {
buffered_lines_limit: DEFAULT_BUFFERED_LINES_LIMIT,
is_lossy: true,
thread_name: "tracing-appender".to_string(),
}
}
}
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 @@ -46,7 +46,7 @@ pub use builder::{Builder, InitError};
/// writes without blocking the current thread.
///
/// Additionally, `RollingFileAppender` also implements the [`MakeWriter`]
/// trait from `tracing-appender`, so it may also be used
/// trait from `tracing-subscriber`, so it may also be used
/// directly, without [`NonBlocking`].
///
/// [write]: std::io::Write
Expand Down
4 changes: 2 additions & 2 deletions tracing-appender/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ impl<T: Write + Send + Sync + 'static> Worker<T> {
}

/// Creates a worker thread that processes a channel until it's disconnected
pub(crate) fn worker_thread(mut self) -> std::thread::JoinHandle<()> {
pub(crate) fn worker_thread(mut self, name: String) -> std::thread::JoinHandle<()> {
thread::Builder::new()
.name("tracing-appender".to_string())
.name(name)
.spawn(move || {
loop {
match self.work() {
Expand Down
Loading