public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/3] fix #5285: api: sync: add job summary to task log
Date: Wed,  6 Mar 2024 15:11:52 +0100	[thread overview]
Message-ID: <20240306141153.419283-3-c.ebner@proxmox.com> (raw)
In-Reply-To: <20240306141153.419283-1-c.ebner@proxmox.com>

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@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





  parent reply	other threads:[~2024-03-06 14:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 14:11 [pbs-devel] [PATCH proxmox-backup 0/3] fix #5285: log global statistics for sync job Christian Ebner
2024-03-06 14:11 ` [pbs-devel] [PATCH proxmox-backup 1/3] server: sync: return `PullStats` for pull related methods Christian Ebner
2024-03-06 14:11 ` Christian Ebner [this message]
2024-03-06 14:11 ` [pbs-devel] [PATCH proxmox-backup 3/3] server: sync: use HumanByte for task log output Christian Ebner
2024-03-06 17:29 ` [pbs-devel] [PATCH proxmox-backup 0/3] fix #5285: log global statistics for sync job Max Carrara
2024-03-07 10:55   ` Max Carrara
2024-03-07 13:59 ` [pbs-devel] applied-series: " Thomas Lamprecht
2024-03-07 14:11   ` Christian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240306141153.419283-3-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal