[pbs-devel] [PATCH proxmox-backup v2 00/13] add metric endpoint

Lukas Wagner l.wagner at proxmox.com
Tue Oct 15 10:46:23 CEST 2024


This patch series adds a new metric endpoint at /status/metrics with the same
metric format as PVE's /cluster/metrics/export.

Patches 1 to 9 are preparatory patches, including
  - moving code around to improve the overall structure
  - style/doc comment improvments

These changes should not result in any functional changes.

Patches 10 to 12 store the results from the stat collection loop in a cache (using proxmox-shared-cache)
in /run/proxmox-backup/metrics. Same as in PVE, we cache the last 180 stat results for a total
of 30 minutes of history.

Finally, patch 13 adds the actual endpoint for fetching the metric data.

Changes since v1 (thx Wolfgang):
  - move api2/status.rs to api2/status/mod.rs
  - move api2/metrics.rs to api2/status/metrics.rs

proxmox-backup:

Lukas Wagner (13):
  proxy: server: move rrd stat/metric server to separate module
  metric collection: add doc comments for public functions
  metric collection: move rrd_cache to new metric_collection module
  metric_collection: split out push metric part
  metric collection: rrd: move rrd update function to rrd module
  metric collection: rrd: restrict function visibility
  metric collection: rrd: remove rrd prefix from some function names
  metric collection: drop std::path prefix where not needed
  metric collection: move impl block for DiskStats to metric_server
    module
  pbs-api-types: add types for the new metrics endpoint
  metric collection: initialize metric cache on startup
  metric collection: put metrics in a cache
  api: add /status/metrics API

 Cargo.toml                                    |   2 +
 pbs-api-types/src/metrics.rs                  |  66 +++
 src/api2/node/rrd.rs                          |   2 +-
 src/api2/status/metrics.rs                    |  73 +++
 src/api2/{status.rs => status/mod.rs}         |  17 +-
 src/bin/proxmox-backup-proxy.rs               | 419 +-----------------
 src/lib.rs                                    |   2 -
 src/server/metric_collection/metric_server.rs | 156 +++++++
 src/server/metric_collection/mod.rs           | 235 ++++++++++
 src/server/metric_collection/pull_metrics.rs  | 185 ++++++++
 .../metric_collection/rrd.rs}                 |  86 +++-
 src/server/mod.rs                             |   2 +
 12 files changed, 814 insertions(+), 431 deletions(-)
 create mode 100644 src/api2/status/metrics.rs
 rename src/api2/{status.rs => status/mod.rs} (93%)
 create mode 100644 src/server/metric_collection/metric_server.rs
 create mode 100644 src/server/metric_collection/mod.rs
 create mode 100644 src/server/metric_collection/pull_metrics.rs
 rename src/{rrd_cache.rs => server/metric_collection/rrd.rs} (60%)


Summary over all repositories:
  12 files changed, 814 insertions(+), 431 deletions(-)

-- 
Generated by git-murpp 0.7.3




More information about the pbs-devel mailing list