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 [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 311631FF189 for <inbox@lore.proxmox.com>; Tue, 18 Feb 2025 16:31:47 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1F51F10C43; Tue, 18 Feb 2025 16:31:44 +0100 (CET) Message-ID: <66b681b7-6307-4501-a504-73e0852531c2@proxmox.com> Date: Tue, 18 Feb 2025 16:31:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox Datacenter Manager development discussion <pdm-devel@lists.proxmox.com>, Wolfgang Bumiller <w.bumiller@proxmox.com>, Lukas Wagner <l.wagner@proxmox.com> References: <20250214130653.283012-1-l.wagner@proxmox.com> <20250214130653.283012-4-l.wagner@proxmox.com> <aguxeubkyqnqrfsrmmo4suxmap34ep34bhs5l3rhhqrjr33hlo@vw7u7jhojkka> Content-Language: en-US From: Stefan Hanreich <s.hanreich@proxmox.com> In-Reply-To: <aguxeubkyqnqrfsrmmo4suxmap34ep34bhs5l3rhhqrjr33hlo@vw7u7jhojkka> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.656 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 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 v2 03/28] pdm-api-types: add CollectionSettings type 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> 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 2/18/25 16:26, Wolfgang Bumiller wrote: > On Fri, Feb 14, 2025 at 02:06:28PM +0100, Lukas Wagner wrote: >> This commit adds the CollectionSettings type which holds settings for >> the metric collection system. Included are collection interval, max >> concurrency and upper/lower bounds for the metric collection loop. >> >> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> >> --- >> lib/pdm-api-types/src/lib.rs | 3 + >> lib/pdm-api-types/src/metric_collection.rs | 188 +++++++++++++++++++++ >> 2 files changed, 191 insertions(+) >> create mode 100644 lib/pdm-api-types/src/metric_collection.rs >> >> diff --git a/lib/pdm-api-types/src/lib.rs b/lib/pdm-api-types/src/lib.rs >> index 38449071..6115e41c 100644 >> --- a/lib/pdm-api-types/src/lib.rs >> +++ b/lib/pdm-api-types/src/lib.rs >> @@ -19,6 +19,9 @@ pub use acl::*; >> mod node_config; >> pub use node_config::*; >> >> +mod metric_collection; >> +pub use metric_collection::*; >> + >> mod proxy; >> pub use proxy::HTTP_PROXY_SCHEMA; >> >> diff --git a/lib/pdm-api-types/src/metric_collection.rs b/lib/pdm-api-types/src/metric_collection.rs >> new file mode 100644 >> index 00000000..92487d6c >> --- /dev/null >> +++ b/lib/pdm-api-types/src/metric_collection.rs >> @@ -0,0 +1,188 @@ >> +//! API types for metric collection settings. >> + >> +use serde::{Deserialize, Serialize}; >> + >> +use proxmox_schema::{api, Updater}; >> + >> +/// Default metric collection interval. >> +pub const DEFAULT_COLLECTION_INTERVAL: u64 = 600; >> + >> +/// Minimum metric collection interval. >> +pub const MIN_COLLECTION_INTERVAL: u64 = 10; >> + >> +/// Maximum metric collection interval. >> +/// PVE and PBS keep 30 minutes of metric history, >> +/// maximum is set to 25 minutes to leave some headroom. >> +pub const MAX_COLLECTION_INTERVAL: u64 = 1500; >> + >> +/// Default number of concurrent connections. >> +pub const DEFAULT_CONCURRENCY: usize = 10; >> +/// Maximum number of concurrent connections. >> +pub const MAX_CONCURRENCY: u64 = 50; >> +/// Minimum number of concurrent connections (no concurrency). >> +pub const MIN_CONCURRENCY: u64 = 1; >> + >> +/// Default upper bound for the random delay for the >> +/// main metric collection loop. >> +pub const DEFAULT_MAX_OFFSET: u64 = 10; >> +/// Default lower bound for the random delay for the >> +/// main metric collection loop. >> +pub const DEFAULT_MIN_OFFSET: u64 = 0; >> + >> +/// Highest configurable upper bound for the random interval offset for the main loop. >> +pub const MAX_INTERVAL_OFFSET: u64 = 300; >> +/// Lowest configureable lower bound for the random interval offset for the main loop. >> +pub const MIN_INTERVAL_OFFSET: u64 = 0; >> + >> +/// Default upper bound for the random individual connection delay. >> +pub const DEFAULT_MAX_CONNECTION_DELAY: u64 = 100; >> +/// Default lower bound for the random individual connection delay. >> +pub const DEFAULT_MIN_CONNECTION_DELAY: u64 = 0; >> + >> +/// Highest configurable upper bound for the random individual connection delay. >> +pub const MAX_CONNECTION_DELAY: u64 = 1000; >> +/// Lowest configurable lower bound for the random individual connection delay. >> +pub const MIN_CONNECTION_DELAY: u64 = 0; >> + >> +#[api( >> + properties: { >> + "collection-interval" : { >> + optional: true, >> + default: DEFAULT_COLLECTION_INTERVAL as isize, >> + minimum: MIN_COLLECTION_INTERVAL as isize, >> + maximum: MAX_COLLECTION_INTERVAL as isize, > > I thought about this the first time around but then forgot again: > > Given that it is possible we might change these types (see Stefan's > patch for proxmox-schema) and because it is much more convenient > anyway you could use `as _` for these casts. fyi: I put it on the backburner for now, because the methods in SDN all got a new parameter (because of locking). This removed the necessity of the patch from my pov - but I can pick it up again today/tomorrow if we want it somewhere else. _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel