From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager v2 18/25] metric collection: clarify naming for remote metric collection
Date: Thu, 19 Mar 2026 10:45:38 +0100 [thread overview]
Message-ID: <20260319094617.169594-19-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260319094617.169594-1-l.wagner@proxmox.com>
Primarily to avoid confusion with the new task that will be added for
local metric collection.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
Tested-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
cli/client/src/metric_collection.rs | 4 ++--
lib/pdm-api-types/src/metric_collection.rs | 2 +-
lib/pdm-client/src/lib.rs | 6 +++---
server/src/api/metric_collection.rs | 10 +++++-----
server/src/api/remotes.rs | 2 +-
server/src/api/rrd_common.rs | 2 +-
server/src/metric_collection/mod.rs | 19 +++++++++++--------
...tion_task.rs => remote_collection_task.rs} | 8 ++++----
server/src/metric_collection/rrd_task.rs | 2 +-
server/src/metric_collection/state.rs | 2 +-
10 files changed, 30 insertions(+), 27 deletions(-)
rename server/src/metric_collection/{collection_task.rs => remote_collection_task.rs} (99%)
diff --git a/cli/client/src/metric_collection.rs b/cli/client/src/metric_collection.rs
index e9dbd804..77dcaab5 100644
--- a/cli/client/src/metric_collection.rs
+++ b/cli/client/src/metric_collection.rs
@@ -34,7 +34,7 @@ pub fn cli() -> CommandLineInterface {
/// all.
async fn trigger_metric_collection(remote: Option<String>) -> Result<(), Error> {
client()?
- .trigger_metric_collection(remote.as_deref())
+ .trigger_remote_metric_collection(remote.as_deref())
.await?;
Ok(())
}
@@ -42,7 +42,7 @@ async fn trigger_metric_collection(remote: Option<String>) -> Result<(), Error>
#[api]
/// Show metric collection status.
async fn metric_collection_status() -> Result<(), Error> {
- let result = client()?.get_metric_collection_status().await?;
+ let result = client()?.get_remote_metric_collection_status().await?;
let output_format = env().format_args.output_format;
if output_format == OutputFormat::Text {
diff --git a/lib/pdm-api-types/src/metric_collection.rs b/lib/pdm-api-types/src/metric_collection.rs
index 5279c8a4..cda6ac2a 100644
--- a/lib/pdm-api-types/src/metric_collection.rs
+++ b/lib/pdm-api-types/src/metric_collection.rs
@@ -8,7 +8,7 @@ use proxmox_schema::api;
#[derive(Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
/// Per-remote collection status.
-pub struct MetricCollectionStatus {
+pub struct RemoteMetricCollectionStatus {
/// The remote's name.
pub remote: String,
/// Any error that occured during the last collection attempt.
diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index 0fee97a7..7ce9c244 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -347,7 +347,7 @@ impl<T: HttpApiClient> PdmClient<T> {
}
/// Trigger metric collection for a single remote or for all remotes, if no remote is provided.
- pub async fn trigger_metric_collection(
+ pub async fn trigger_remote_metric_collection(
&self,
remote: Option<&str>,
) -> Result<(), proxmox_client::Error> {
@@ -368,9 +368,9 @@ impl<T: HttpApiClient> PdmClient<T> {
}
/// Get global metric collection status.
- pub async fn get_metric_collection_status(
+ pub async fn get_remote_metric_collection_status(
&self,
- ) -> Result<Vec<pdm_api_types::MetricCollectionStatus>, Error> {
+ ) -> Result<Vec<pdm_api_types::RemoteMetricCollectionStatus>, Error> {
let path = "/api2/extjs/remotes/metric-collection/status";
Ok(self.0.get(path).await?.expect_json()?.data)
}
diff --git a/server/src/api/metric_collection.rs b/server/src/api/metric_collection.rs
index b4c81c68..5a480b36 100644
--- a/server/src/api/metric_collection.rs
+++ b/server/src/api/metric_collection.rs
@@ -4,7 +4,7 @@ use proxmox_router::{Router, SubdirMap};
use proxmox_schema::api;
use proxmox_sortable_macro::sortable;
-use pdm_api_types::{remotes::REMOTE_ID_SCHEMA, MetricCollectionStatus};
+use pdm_api_types::{remotes::REMOTE_ID_SCHEMA, RemoteMetricCollectionStatus};
use crate::metric_collection;
@@ -34,7 +34,7 @@ const SUBDIRS: SubdirMap = &sorted!([
)]
/// Trigger metric collection for a provided remote or for all remotes if no remote is passed.
pub async fn trigger_metric_collection(remote: Option<String>) -> Result<(), Error> {
- crate::metric_collection::trigger_metric_collection(remote, false).await?;
+ crate::metric_collection::trigger_remote_metric_collection(remote, false).await?;
Ok(())
}
@@ -44,11 +44,11 @@ pub async fn trigger_metric_collection(remote: Option<String>) -> Result<(), Err
type: Array,
description: "A list of metric collection statuses.",
items: {
- type: MetricCollectionStatus,
+ type: RemoteMetricCollectionStatus,
}
}
)]
/// Read metric collection status.
-fn get_metric_collection_status() -> Result<Vec<MetricCollectionStatus>, Error> {
- metric_collection::get_status()
+fn get_metric_collection_status() -> Result<Vec<RemoteMetricCollectionStatus>, Error> {
+ metric_collection::remote_metric_collection_status()
}
diff --git a/server/src/api/remotes.rs b/server/src/api/remotes.rs
index 9700611d..678e0ed2 100644
--- a/server/src/api/remotes.rs
+++ b/server/src/api/remotes.rs
@@ -324,7 +324,7 @@ pub async fn add_remote(mut entry: Remote, create_token: Option<String>) -> Resu
pdm_config::remotes::save_config(remotes)?;
- if let Err(e) = metric_collection::trigger_metric_collection(Some(name), false).await {
+ if let Err(e) = metric_collection::trigger_remote_metric_collection(Some(name), false).await {
log::error!("could not trigger metric collection after adding remote: {e}");
}
diff --git a/server/src/api/rrd_common.rs b/server/src/api/rrd_common.rs
index b5d1a786..8c0fb798 100644
--- a/server/src/api/rrd_common.rs
+++ b/server/src/api/rrd_common.rs
@@ -74,7 +74,7 @@ pub async fn get_rrd_datapoints<T: DataPoint + Send + 'static>(
// is super slow or if the metric collection tasks currently busy with collecting other
// metrics, we just return the data we already have, not the newest one.
let _ = tokio::time::timeout(WAIT_FOR_NEWEST_METRIC_TIMEOUT, async {
- metric_collection::trigger_metric_collection(Some(remote), true).await
+ metric_collection::trigger_remote_metric_collection(Some(remote), true).await
})
.await;
}
diff --git a/server/src/metric_collection/mod.rs b/server/src/metric_collection/mod.rs
index 0e6860fc..6bc534f8 100644
--- a/server/src/metric_collection/mod.rs
+++ b/server/src/metric_collection/mod.rs
@@ -7,16 +7,16 @@ use nix::sys::stat::Mode;
use tokio::sync::mpsc::{self, Sender};
use tokio::sync::oneshot;
-use pdm_api_types::MetricCollectionStatus;
+use pdm_api_types::RemoteMetricCollectionStatus;
use pdm_buildcfg::PDM_STATE_DIR_M;
-mod collection_task;
+mod remote_collection_task;
pub mod rrd_cache;
mod rrd_task;
mod state;
pub mod top_entities;
-use collection_task::{ControlMsg, MetricCollectionTask};
+use remote_collection_task::{ControlMsg, RemoteMetricCollectionTask};
use rrd_cache::RrdCache;
const RRD_CACHE_BASEDIR: &str = concat!(PDM_STATE_DIR_M!(), "/rrdb");
@@ -46,7 +46,7 @@ pub fn start_task() -> Result<(), Error> {
tokio::spawn(async move {
let metric_collection_task_future = pin!(async move {
- match MetricCollectionTask::new(metric_data_tx, trigger_collection_rx) {
+ match RemoteMetricCollectionTask::new(metric_data_tx, trigger_collection_rx) {
Ok(mut task) => task.run().await,
Err(err) => log::error!("could not start metric collection task: {err}"),
}
@@ -76,7 +76,10 @@ pub fn start_task() -> Result<(), Error> {
///
/// Has no effect if the tx end of the channel has not been initialized yet.
/// Returns an error if the mpsc channel has been closed already.
-pub async fn trigger_metric_collection(remote: Option<String>, wait: bool) -> Result<(), Error> {
+pub async fn trigger_remote_metric_collection(
+ remote: Option<String>,
+ wait: bool,
+) -> Result<(), Error> {
let (done_sender, done_receiver) = oneshot::channel();
if let Some(sender) = CONTROL_MESSAGE_TX.get() {
@@ -93,15 +96,15 @@ pub async fn trigger_metric_collection(remote: Option<String>, wait: bool) -> Re
}
/// Get each remote's metric collection status.
-pub fn get_status() -> Result<Vec<MetricCollectionStatus>, Error> {
+pub fn remote_metric_collection_status() -> Result<Vec<RemoteMetricCollectionStatus>, Error> {
let (remotes, _) = pdm_config::remotes::config()?;
- let state = collection_task::load_state()?;
+ let state = remote_collection_task::load_state()?;
let mut result = Vec::new();
for (remote, _) in remotes.into_iter() {
if let Some(status) = state.get_status(&remote) {
- result.push(MetricCollectionStatus {
+ result.push(RemoteMetricCollectionStatus {
remote,
error: status.error.clone(),
last_collection: status.last_collection,
diff --git a/server/src/metric_collection/collection_task.rs b/server/src/metric_collection/remote_collection_task.rs
similarity index 99%
rename from server/src/metric_collection/collection_task.rs
rename to server/src/metric_collection/remote_collection_task.rs
index cc1a460e..eca0e11d 100644
--- a/server/src/metric_collection/collection_task.rs
+++ b/server/src/metric_collection/remote_collection_task.rs
@@ -46,13 +46,13 @@ pub(super) enum ControlMsg {
/// Task which periodically collects metrics from all remotes and stores
/// them in the local metrics database.
-pub(super) struct MetricCollectionTask {
+pub(super) struct RemoteMetricCollectionTask {
state: MetricCollectionState,
metric_data_tx: Sender<RrdStoreRequest>,
control_message_rx: Receiver<ControlMsg>,
}
-impl MetricCollectionTask {
+impl RemoteMetricCollectionTask {
/// Create a new metric collection task.
pub(super) fn new(
metric_data_tx: Sender<RrdStoreRequest>,
@@ -574,7 +574,7 @@ pub(super) mod tests {
let (_control_tx, control_rx) = tokio::sync::mpsc::channel(10);
- let mut task = MetricCollectionTask {
+ let mut task = RemoteMetricCollectionTask {
state,
metric_data_tx: tx,
control_message_rx: control_rx,
@@ -644,7 +644,7 @@ pub(super) mod tests {
let (_control_tx, control_rx) = tokio::sync::mpsc::channel(10);
- let mut task = MetricCollectionTask {
+ let mut task = RemoteMetricCollectionTask {
state,
metric_data_tx: tx,
control_message_rx: control_rx,
diff --git a/server/src/metric_collection/rrd_task.rs b/server/src/metric_collection/rrd_task.rs
index 48b6de9e..29137858 100644
--- a/server/src/metric_collection/rrd_task.rs
+++ b/server/src/metric_collection/rrd_task.rs
@@ -200,7 +200,7 @@ mod tests {
use pve_api_types::{ClusterMetrics, ClusterMetricsData};
use crate::{
- metric_collection::collection_task::tests::get_create_options,
+ metric_collection::remote_collection_task::tests::get_create_options,
test_support::temp::NamedTempDir,
};
diff --git a/server/src/metric_collection/state.rs b/server/src/metric_collection/state.rs
index 7f68843e..fd313c48 100644
--- a/server/src/metric_collection/state.rs
+++ b/server/src/metric_collection/state.rs
@@ -92,7 +92,7 @@ impl MetricCollectionState {
#[cfg(test)]
mod tests {
- use crate::metric_collection::collection_task::tests::get_create_options;
+ use crate::metric_collection::remote_collection_task::tests::get_create_options;
use crate::test_support::temp::NamedTempFile;
use super::*;
--
2.47.3
next prev parent reply other threads:[~2026-03-19 9:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 9:45 [PATCH datacenter-manager/proxmox{,-backup,-yew-comp} v2 00/25] metric collection for the PDM host Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 01/25] parallel-handler: import code from Proxmox Backup Server Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 02/25] parallel-handler: introduce custom error type Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 03/25] parallel-handler: add documentation Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 04/25] parallel-handler: add simple unit-test suite Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 06/25] disks: fix typo in `initialize_gpt_disk` Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 07/25] disks: add parts of gather_disk_stats from PBS Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 08/25] disks: gate api macro behind 'api-types' feature Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 09/25] disks: clippy: collapse if-let chains where possible Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 10/25] procfs: add helpers for querying pressure stall information Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox v2 11/25] time: use u64 parse helper from nom Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox-backup v2 12/25] tools: move ParallelHandler to new proxmox-parallel-handler crate Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox-backup v2 13/25] tools: replace disks module with proxmox-disks Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox-backup v2 14/25] metric collection: use blockdev_stat_for_path from proxmox_disks Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox-yew-comp v2 15/25] node status panel: add `children` property Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox-yew-comp v2 16/25] RRDGrid: fix size observer by attaching node reference to rendered container Lukas Wagner
2026-03-19 9:45 ` [PATCH proxmox-yew-comp v2 17/25] RRDGrid: add padding and increase gap between elements Lukas Wagner
2026-03-19 9:45 ` Lukas Wagner [this message]
2026-03-19 9:45 ` [PATCH datacenter-manager v2 19/25] metric collection: fix minor typo in error message Lukas Wagner
2026-03-19 9:45 ` [PATCH datacenter-manager v2 20/25] metric collection: collect PDM host metrics in a new collection task Lukas Wagner
2026-03-19 9:45 ` [PATCH datacenter-manager v2 21/25] api: fix /nodes/localhost/rrddata endpoint Lukas Wagner
2026-03-19 9:45 ` [PATCH datacenter-manager v2 22/25] pdm: node rrd data: rename 'total-time' to 'metric-collection-total-time' Lukas Wagner
2026-03-19 9:45 ` [PATCH datacenter-manager v2 23/25] pdm-api-types: add PDM host metric fields Lukas Wagner
2026-03-19 9:45 ` [PATCH datacenter-manager v2 24/25] ui: node status: add RRD graphs for PDM host metrics Lukas Wagner
2026-03-19 9:45 ` [PATCH datacenter-manager v2 25/25] ui: lxc/qemu/node: use RRD value render helpers Lukas Wagner
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=20260319094617.169594-19-l.wagner@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pdm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.