From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 19/26] metric collection: clarify naming for remote metric collection
Date: Thu, 12 Mar 2026 14:52:20 +0100 [thread overview]
Message-ID: <20260312135229.420729-20-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260312135229.420729-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>
---
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-12 13:53 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 13:52 [PATCH datacenter-manager/proxmox{,-backup,-yew-comp} 00/26] metric collection for the PDM host Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 01/26] sys: procfs: don't read from sysfs during unit tests Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 02/26] parallel-handler: import code from Proxmox Backup Server Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 03/26] parallel-handler: introduce custom error type Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 04/26] parallel-handler: add documentation Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 05/26] parallel-handler: add simple unit-test suite Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 06/26] disks: import from Proxmox Backup Server Lukas Wagner
2026-03-16 13:13 ` Arthur Bied-Charreton
2026-03-12 13:52 ` [PATCH proxmox 07/26] disks: fix typo in `initialize_gpt_disk` Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 08/26] disks: add parts of gather_disk_stats from PBS Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 09/26] disks: gate api macro behind 'api-types' feature Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 10/26] disks: clippy: collapse if-let chains where possible Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox 11/26] procfs: add helpers for querying pressure stall information Lukas Wagner
2026-03-16 13:25 ` Arthur Bied-Charreton
2026-03-12 13:52 ` [PATCH proxmox 12/26] time: use u64 parse helper from nom Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-backup 13/26] tools: move ParallelHandler to new proxmox-parallel-handler crate Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-backup 14/26] tools: replace disks module with proxmox-disks Lukas Wagner
2026-03-16 13:27 ` Arthur Bied-Charreton
2026-03-12 13:52 ` [PATCH proxmox-backup 15/26] metric collection: use blockdev_stat_for_path from proxmox_disks Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-yew-comp 16/26] node status panel: add `children` property Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-yew-comp 17/26] RRDGrid: fix size observer by attaching node reference to rendered container Lukas Wagner
2026-03-12 13:52 ` [PATCH proxmox-yew-comp 18/26] RRDGrid: add padding and increase gap between elements Lukas Wagner
2026-03-12 13:52 ` Lukas Wagner [this message]
2026-03-12 13:52 ` [PATCH datacenter-manager 20/26] metric collection: fix minor typo in error message Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 21/26] metric collection: collect PDM host metrics in a new collection task Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 22/26] api: fix /nodes/localhost/rrddata endpoint Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 23/26] pdm: node rrd data: rename 'total-time' to 'metric-collection-total-time' Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 24/26] pdm-api-types: add PDM host metric fields Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 25/26] ui: node status: add RRD graphs for PDM host metrics Lukas Wagner
2026-03-12 13:52 ` [PATCH datacenter-manager 26/26] ui: lxc/qemu/node: use RRD value render helpers Lukas Wagner
2026-03-16 13:42 ` [PATCH datacenter-manager/proxmox{,-backup,-yew-comp} 00/26] metric collection for the PDM host Arthur Bied-Charreton
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=20260312135229.420729-20-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox