From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pdm-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 47A951FF16F
	for <inbox@lore.proxmox.com>; Thu, 13 Feb 2025 12:53:21 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 1A18C2203;
	Thu, 13 Feb 2025 12:53:18 +0100 (CET)
Date: Thu, 13 Feb 2025 12:53:14 +0100
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Lukas Wagner <l.wagner@proxmox.com>
Message-ID: <l2mqcumyqraaf4qtjxs2ad7h7qqn5pbqhxhk2vvr2exyv5573d@erarn27rnlce>
References: <20250211120541.163621-1-l.wagner@proxmox.com>
 <20250211120541.163621-18-l.wagner@proxmox.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <20250211120541.163621-18-l.wagner@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.083 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pdm-devel] [PATCH proxmox-datacenter-manager 17/25] metric
 collection: save time needed for collection run to RRD
X-BeenThere: pdm-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Datacenter Manager development discussion
 <pdm-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pdm-devel>, 
 <mailto:pdm-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pdm-devel/>
List-Post: <mailto:pdm-devel@lists.proxmox.com>
List-Help: <mailto:pdm-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel>, 
 <mailto:pdm-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox Datacenter Manager development discussion
 <pdm-devel@lists.proxmox.com>
Cc: pdm-devel@lists.proxmox.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pdm-devel-bounces@lists.proxmox.com
Sender: "pdm-devel" <pdm-devel-bounces@lists.proxmox.com>

On Tue, Feb 11, 2025 at 01:05:33PM +0100, Lukas Wagner wrote:
> For large setups, it might be useful to know how much time was needed to
> collect metrics for *all* remotes together, e.g. for making sure that
> the collection interval is not exceeded.
> 
> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
> ---
>  .../src/metric_collection/collection_task.rs  | 15 ++++++
>  server/src/metric_collection/rrd_task.rs      | 50 +++++++++++++++----
>  2 files changed, 56 insertions(+), 9 deletions(-)
> 
> diff --git a/server/src/metric_collection/collection_task.rs b/server/src/metric_collection/collection_task.rs
> index 27a9987..501df9b 100644
> --- a/server/src/metric_collection/collection_task.rs
> +++ b/server/src/metric_collection/collection_task.rs
> @@ -22,6 +22,7 @@ use pdm_api_types::{
>  };
>  use pdm_config::metric_collection::COLLECTION_SETTINGS_TYPE;
>  
> +use crate::metric_collection::rrd_task::CollectionStats;
>  use crate::{connection, task_utils};
>  
>  use super::{
> @@ -97,6 +98,20 @@ impl MetricCollectionTask {
>                      if let Some(remotes) = Self::load_remote_config() {
>                          let to_fetch = remotes.order.as_slice();
>                          self.fetch_remotes(&remotes, to_fetch).await;
> +
> +                        let now = Instant::now();
> +                        self.fetch_remotes(&remotes, &remotes.order).await;

2 `fetch_remotes` calls now look a bit weird ;-)
should probably fold in some later change?

> +                        let elapsed = now.elapsed();
> +
> +                        if let Err(err) = self.metric_data_tx.send(
> +                            RrdStoreRequest::CollectionStats {
> +                                timestamp: proxmox_time::epoch_i64(),
> +                                stats: CollectionStats {
> +                                    total_time: elapsed.as_secs_f64() * 1000.
> +                                }
> +                            }).await {
> +                            log::error!("could not send collection stats to rrd task: {err}");
> +                        }
>                      }
>                  }
>  


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel