From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5BB96735AA for ; Fri, 27 May 2022 13:40:58 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 51589D769 for ; Fri, 27 May 2022 13:40:58 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 072E1D75C for ; Fri, 27 May 2022 13:40:57 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A50B4438D5 for ; Fri, 27 May 2022 13:40:56 +0200 (CEST) Message-ID: <83710c54-145b-c416-0caf-f1c0ef21dd44@proxmox.com> Date: Fri, 27 May 2022 13:40:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: pbs-devel@lists.proxmox.com References: <20220527105728.132412-1-d.tschlatscher@proxmox.com> <20220527105728.132412-2-d.tschlatscher@proxmox.com> From: Daniel Tschlatscher In-Reply-To: <20220527105728.132412-2-d.tschlatscher@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.886 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -1.995 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/1] fix #4077: Estimated Full metric on ext4 file systems X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2022 11:40:58 -0000 Talked with Dominic off-list: I had a bit of an error in reasoning with the usage of 'available' here which means it does not work quite as I expected here. Therefore, please ignore this patch. I will try to re(think) and rewrite this patch in v2. The first patch should still be applicable though, as it does not impact any of this. On 5/27/22 12:57, Daniel Tschlatscher wrote: > The estimated full statistics metric no longer uses the total amount > of space on a disk, but rather the still available. Also refactored > some variable names for the 'estimated_full' calculation to make it > clearer what changed/is used now. > > Note: Statistics for 'available' were not tracked in the rrdb before, > existing datastores will therefore show a somewhat incorrect value for > 'estimated_full', at least until it is populated with enough new > values. > > Signed-off-by: Daniel Tschlatscher > --- > src/api2/status.rs | 14 +++++++------- > src/bin/proxmox-backup-proxy.rs | 2 ++ > 2 files changed, 9 insertions(+), 7 deletions(-) > > diff --git a/src/api2/status.rs b/src/api2/status.rs > index 45aa7fd7..f7d96c49 100644 > --- a/src/api2/status.rs > +++ b/src/api2/status.rs > @@ -88,25 +88,25 @@ pub fn datastore_status( > let get_rrd = > |what: &str| extract_rrd_data(&rrd_dir, what, RRDTimeFrame::Month, RRDMode::Average); > > - let total_res = get_rrd("total")?; > + let avail_res = get_rrd("available")?; > let used_res = get_rrd("used")?; > > - if let (Some((start, reso, total_list)), Some((_, _, used_list))) = (total_res, used_res) { > + if let (Some((start, reso, avail_list)), Some((_, _, used_list))) = (avail_res, used_res) { > let mut usage_list: Vec = Vec::new(); > let mut time_list: Vec = Vec::new(); > let mut history = Vec::new(); > > for (idx, used) in used_list.iter().enumerate() { > - let total = if idx < total_list.len() { > - total_list[idx] > + let available = if idx < avail_list.len() { > + avail_list[idx] > } else { > None > }; > > - match (total, used) { > - (Some(total), Some(used)) if total != 0.0 => { > + match (available, used) { > + (Some(available), Some(used)) if available != 0.0 => { > time_list.push(start + (idx as u64) * reso); > - let usage = used / total; > + let usage = used / available; > usage_list.push(usage); > history.push(Some(usage)); > } > diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs > index 659f7b4a..82f40a54 100644 > --- a/src/bin/proxmox-backup-proxy.rs > +++ b/src/bin/proxmox-backup-proxy.rs > @@ -1140,6 +1140,8 @@ fn gather_disk_stats(disk_manager: Arc, path: &Path, rrd_prefix: &st > rrd_update_gauge(&rrd_key, status.total as f64); > let rrd_key = format!("{}/used", rrd_prefix); > rrd_update_gauge(&rrd_key, status.used as f64); > + let rrd_key = format!("{}/available", rrd_prefix); > + rrd_update_gauge(&rrd_key, status.avail as f64); > } > Err(err) => { > eprintln!("read disk_usage on {:?} failed - {}", path, err);