Skip to content

Commit

Permalink
bump minimum tracing from 0.1.25 to 0.1.29
Browse files Browse the repository at this point in the history
This is needed to get have Value implemented for Option<T>.

Also fix tracing instrumentation tests now that original_size.bytes
won't be recorded if it's the same as size.bytes.
  • Loading branch information
hds committed Oct 2, 2024
1 parent d358a3b commit 1719b40
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tokio-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ futures-io = { version = "0.3.0", optional = true }
futures-util = { version = "0.3.0", optional = true }
pin-project-lite = "0.2.11"
slab = { version = "0.4.4", optional = true } # Backs `DelayQueue`
tracing = { version = "0.1.25", default-features = false, features = ["std"], optional = true }
tracing = { version = "0.1.29", default-features = false, features = ["std"], optional = true }

[target.'cfg(tokio_unstable)'.dependencies]
hashbrown = { version = "0.14.0", default-features = false, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ socket2 = { version = "0.5.5", optional = true, features = [ "all" ] }
# Currently unstable. The API exposed by these features may be broken at any time.
# Requires `--cfg tokio_unstable` to enable.
[target.'cfg(tokio_unstable)'.dependencies]
tracing = { version = "0.1.25", default-features = false, features = ["std"], optional = true } # Not in full
tracing = { version = "0.1.29", default-features = false, features = ["std"], optional = true } # Not in full

# Currently unstable. The API exposed by these features may be broken at any time.
# Requires `--cfg tokio_unstable` to enable.
Expand Down
16 changes: 7 additions & 9 deletions tokio/tests/tracing-instrumentation/tests/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,9 @@ async fn task_spawn_sizes_recorded() {
let task_span = expect::span()
.named("runtime.spawn")
.with_target("tokio::task")
.with_field(
expect::field("size.bytes")
.with_value(&size)
.and(expect::field("original_size.bytes").with_value(&size)),
);
// TODO(hds): check that original_size.bytes is NOT recorded when this can be done in
// tracing-mock without listing every other field.
.with_field(expect::field("size.bytes").with_value(&size));

let (subscriber, handle) = subscriber::mock().new_span(task_span).run_with_handle();

Expand All @@ -129,12 +127,12 @@ async fn task_big_spawn_sizes_recorded() {
let future = {
async fn big<const N: usize>() {
let mut a = [0_u8; N];
for idx in 0..N {
a[idx] = (idx % 256) as u8;
for (idx, item) in a.iter_mut().enumerate() {
*item = (idx % 256) as u8;
}
tokio::time::sleep(Duration::from_millis(10)).await;
for idx in 0..N {
assert_eq!(a[idx], (idx % 256) as u8);
for (idx, item) in a.iter_mut().enumerate() {
assert_eq!(*item, (idx % 256) as u8);
}
}

Expand Down

0 comments on commit 1719b40

Please sign in to comment.