[pbs-devel] [PATCH proxmox-backup 2/3] fix #5285: api: sync: add job summary to task log

Christian Ebner c.ebner at proxmox.com
Wed Mar 6 15:11:52 CET 2024


Adds a summary to the tasklog showing the size and number of chunks
pulled as well as the average transfer rate.

Bugtracker link:
https://bugzilla.proxmox.com/show_bug.cgi?id=5285

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/api2/pull.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/api2/pull.rs b/src/api2/pull.rs
index eb9a2199..b72e5cef 100644
--- a/src/api2/pull.rs
+++ b/src/api2/pull.rs
@@ -13,6 +13,7 @@ use pbs_api_types::{
     TRANSFER_LAST_SCHEMA,
 };
 use pbs_config::CachedUserInfo;
+use proxmox_human_byte::HumanByte;
 use proxmox_rest_server::WorkerTask;
 
 use crate::server::jobstate::Job;
@@ -144,7 +145,16 @@ pub fn do_sync_job(
                     sync_job.remote_store,
                 );
 
-                pull_store(&worker, pull_params).await?;
+                let pull_stats = pull_store(&worker, pull_params).await?;
+                task_log!(
+                    worker,
+                    "Summary: sync job pulled {} in {} chunks (average rate: {}/s)",
+                    HumanByte::from(pull_stats.bytes),
+                    pull_stats.chunk_count,
+                    HumanByte::new_binary(
+                        pull_stats.bytes as f64 / pull_stats.elapsed.as_secs_f64()
+                    ),
+                );
 
                 task_log!(worker, "sync job '{}' end", &job_id);
 
-- 
2.39.2





More information about the pbs-devel mailing list