[PATCH proxmox v6 04/12] s3-client: account for upload traffic on successful request sending

Christian Ebner
2026-03-19T09:41:41Z

If the request could be send with success, account for uploaded
traffic in the request counters. Do not account the traffic if
the request could not be send completely.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
proxmox-s3-client/src/client.rs | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
index 6afc9db3..f11326db 100644
--- a/proxmox-s3-client/src/client.rs
+++ b/proxmox-s3-client/src/client.rs
@@ -452,6 +452,11 @@ impl S3Client {
&& response.is_ok()
{
let _prev = counters.increment(parts.method.clone(), Ordering::AcqRel);
+ let transferred: u64 = body_bytes
+ .len()
+ .try_into()
+ .context("failed to account for upload traffic")?;
+ let _prev_uploaded = counters.add_upload_traffic(transferred, Ordering::AcqRel);
}
return Ok(response?);
}
--
2.47.3