[PATCH proxmox v7 03/34] s3-client: account for upload traffic on successful request sending

Christian Ebner
2026-04-01T13:49:02Z

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>
Reviewed-by: Hannes Laimer <h.laimer@proxmox.com>
Tested-by: Hannes Laimer <h.laimer@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 f8aaa1af..8167b1d1 100644
--- a/proxmox-s3-client/src/client.rs
+++ b/proxmox-s3-client/src/client.rs
@@ -444,6 +444,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