[PATCH proxmox v7 09/34] pbs-api-types: define api type for s3 request statistics

Christian Ebner
2026-04-01T13:48:22Z

Will be used as part of the status response for PBS datastores in
order to show the S3 request statistics in the UI.

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>
---
pbs-api-types/src/datastore.rs | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index 3e87eaaa..2b9df967 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -1680,6 +1680,10 @@ pub struct GarbageCollectionJobStatus {
"backend-type": {
type: DatastoreBackendType,
},
+ "s3-statistics": {
+ type: S3Statistics,
+ optional: true,
+ },
},
)]
#[derive(Serialize, Deserialize)]
@@ -1701,6 +1705,30 @@ pub struct DataStoreStatus {
/// Datastore backend type
#[serde(default)]
pub backend_type: DatastoreBackendType,
+ /// S3 backend statistics (on datastores with s3 backend only).
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub s3_statistics: Option<S3Statistics>,
+}
+
+#[api()]
+#[derive(Serialize, Deserialize, Clone, PartialEq)]
+#[serde(rename_all = "kebab-case")]
+/// Statistics specific to the S3 backend
+pub struct S3Statistics {
+ /// Total downloaded (bytes).
+ pub downloaded: u64,
+ /// Total uploaded (bytes).
+ pub uploaded: u64,
+ /// Get requests
+ pub get: u64,
+ /// Post requests
+ pub post: u64,
+ /// Put requests
+ pub put: u64,
+ /// Head requests
+ pub head: u64,
+ /// Delete requests
+ pub delete: u64,
}

#[api(
--
2.47.3