]> git.proxmox.com Git - proxmox-backup.git/commitdiff
fix #5285: api: sync job: add job summary to task log
authorChristian Ebner <c.ebner@proxmox.com>
Wed, 6 Mar 2024 14:11:52 +0000 (15:11 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 7 Mar 2024 13:34:34 +0000 (14:34 +0100)
Adds a summary to the end of the task log showing the size and number
of chunks pulled as well as the average transfer rate.

Such an entry looks something like:
> Summary: sync job pulled 214.445 MiB in 166 chunks (average rate: 111.012 MiB/s)

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=5285
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/api2/pull.rs

index eb9a21993ea925448587e5fd5f39f699702b81d9..b72e5cefc0f7ebe68f7919914dd4abe9c594b87e 100644 (file)
@@ -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);