From 57b47dd44e0d09a82fce56fb24fefb3c39c7cafb Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Wed, 17 Jul 2024 09:29:07 -0400 Subject: [PATCH] Emit a span for `get_zarr_manifest()` --- Cargo.lock | 2 ++ Cargo.toml | 1 + src/main.rs | 3 +-- src/zarrman/mod.rs | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1b3ce33..76e74a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -871,6 +871,7 @@ dependencies = [ "tracing", "tracing-subscriber", "url", + "uuid", "xml-rs", ] @@ -3084,6 +3085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", + "rand", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ef56189..987029f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,6 +50,7 @@ tower-http = { version = "0.5.2", features = ["set-header", "trace"] } tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["json", "local-time", "time"] } url = { version = "2.5.2", features = ["serde"] } +uuid = { version = "1.10.0", features = ["fast-rng", "v4"] } xml-rs = "0.8.20" [dev-dependencies] diff --git a/src/main.rs b/src/main.rs index eb92d55..c94b249 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,6 @@ use axum::{ }; use clap::Parser; use std::fmt; -use std::io::stderr; use std::net::IpAddr; use std::sync::Arc; use tower::service_fn; @@ -78,7 +77,7 @@ fn main() -> anyhow::Result<()> { tracing_subscriber::fmt::layer() .json() .with_timer(timer) - .with_writer(stderr), + .with_writer(std::io::stderr), ) .with( Targets::new() diff --git a/src/zarrman/mod.rs b/src/zarrman/mod.rs index 48cfb33..8e91d77 100644 --- a/src/zarrman/mod.rs +++ b/src/zarrman/mod.rs @@ -274,6 +274,7 @@ impl ZarrManClient { /// Retrieve the Zarr manifest at the given [`ManifestPath`] in the /// manifest tree, either via an HTTP request or from a cache + #[tracing::instrument(skip_all, fields(id = %uuid::Uuid::new_v4(), manifest = %path))] async fn get_zarr_manifest( &self, path: &ManifestPath,