diff --git a/Cargo.lock b/Cargo.lock index 04130da61..77a27d6b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -620,9 +620,9 @@ checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "bytesize" -version = "1.3.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" +checksum = "a3c8f83209414aacf0eeae3cf730b18d6981697fba62f200fcfb92b9f082acba" [[package]] name = "camino" diff --git a/crates/matrix-sdk/Cargo.toml b/crates/matrix-sdk/Cargo.toml index 11ec5ea65..d73d5edb0 100644 --- a/crates/matrix-sdk/Cargo.toml +++ b/crates/matrix-sdk/Cargo.toml @@ -60,7 +60,7 @@ async-stream = { workspace = true } async-trait = { workspace = true } axum = { version = "0.8.1", optional = true } bytes = "1.9.0" -bytesize = "1.3.0" +bytesize = "2.0.1" event-listener = "5.4.0" eyeball = { workspace = true } eyeball-im = { workspace = true } diff --git a/crates/matrix-sdk/src/http_client/mod.rs b/crates/matrix-sdk/src/http_client/mod.rs index bca3c6b62..8d61e1662 100644 --- a/crates/matrix-sdk/src/http_client/mod.rs +++ b/crates/matrix-sdk/src/http_client/mod.rs @@ -204,7 +204,10 @@ impl HttpClient { // in conjunction with request bodies if [Method::POST, Method::PUT, Method::PATCH].contains(method) { let request_size = request.body().len().try_into().unwrap_or(u64::MAX); - span.record("request_size", ByteSize(request_size).to_string_as(true)); + span.record( + "request_size", + ByteSize(request_size).display().si_short().to_string(), + ); } request diff --git a/crates/matrix-sdk/src/http_client/native.rs b/crates/matrix-sdk/src/http_client/native.rs index 6cc2340c9..2c0ef63d2 100644 --- a/crates/matrix-sdk/src/http_client/native.rs +++ b/crates/matrix-sdk/src/http_client/native.rs @@ -94,7 +94,7 @@ impl HttpClient { let response_size = ByteSize(response.body().len().try_into().unwrap_or(u64::MAX)); tracing::Span::current() .record("status", status_code.as_u16()) - .record("response_size", response_size.to_string_as(true)); + .record("response_size", response_size.display().si_short().to_string()); // Record interesting headers. If you add more headers, ensure they're not // confidential. diff --git a/crates/matrix-sdk/src/http_client/wasm.rs b/crates/matrix-sdk/src/http_client/wasm.rs index 0c438d519..9326b98f0 100644 --- a/crates/matrix-sdk/src/http_client/wasm.rs +++ b/crates/matrix-sdk/src/http_client/wasm.rs @@ -42,7 +42,7 @@ impl HttpClient { let response_size = ByteSize(response.body().len().try_into().unwrap_or(u64::MAX)); tracing::Span::current() .record("status", status_code.as_u16()) - .record("response_size", response_size.to_string_as(true)); + .record("response_size", response_size.display().si_short().to_string()); Ok(R::IncomingResponse::try_from_http_response(response)?) }