diff --git a/proxmox-metrics/src/influxdb/http.rs b/proxmox-metrics/src/influxdb/http.rs index 51a4181a..c10c55d3 100644 --- a/proxmox-metrics/src/influxdb/http.rs +++ b/proxmox-metrics/src/influxdb/http.rs @@ -36,8 +36,7 @@ pub async fn test_influxdb_http( this.test_connection().await } -/// Returns a [Metrics] handle that connects and sends data to the -/// given influxdb server at the given https url +/// Get a [`Metrics`] handle for an influxdb server accessed via HTTPS. pub fn influxdb_http( uri: &str, organization: &str, diff --git a/proxmox-metrics/src/influxdb/udp.rs b/proxmox-metrics/src/influxdb/udp.rs index b73eb594..1c6cd6d5 100644 --- a/proxmox-metrics/src/influxdb/udp.rs +++ b/proxmox-metrics/src/influxdb/udp.rs @@ -22,8 +22,7 @@ pub async fn test_influxdb_udp(address: &str) -> Result<(), Error> { Ok(()) } -/// Returns a [`Metrics`] handle that connects and sends data to the -/// given influxdb server at the given udp address/port +/// Get a [`Metrics`] handle for an influxdb server accessed via UDP. /// /// `address` must be in the format of `ip_or_hostname:port` pub fn influxdb_udp(address: &str, mtu: Option) -> Metrics { diff --git a/proxmox-metrics/src/lib.rs b/proxmox-metrics/src/lib.rs index 9fb098ee..75c22e39 100644 --- a/proxmox-metrics/src/lib.rs +++ b/proxmox-metrics/src/lib.rs @@ -11,20 +11,23 @@ mod influxdb; pub use influxdb::{influxdb_http, influxdb_udp, test_influxdb_http, test_influxdb_udp}; #[derive(Clone)] -/// Structured data for the metric server +/// Structured data for the metric server. pub struct MetricsData { - /// The category of measurements + /// The category of measurements. pub measurement: String, - /// A list of to attach to the measurements + + /// A list of to attach to the measurements. pub tags: HashMap, + /// The actual values to send. Only plain (not-nested) objects are supported at the moment. pub values: Value, - /// The time of the measurement + + /// The time of the measurement. pub ctime: i64, } impl MetricsData { - /// Convenient helper to create from references + /// Convenient helper to create from references. pub fn new( measurement: &str, tags: &[(&str, &str)], @@ -45,7 +48,7 @@ impl MetricsData { } } -/// Helper to send a list of [MetricsData] to a list of [Metrics] +/// Helper to send a list of [`MetricsData`] to a list of [`Metrics`]. pub async fn send_data_to_channels( values: &[Arc], connections: &[Metrics], @@ -65,7 +68,7 @@ pub async fn send_data_to_channels( /// Represents connection to the metric server which can be used to send data /// -/// You can send [MetricsData] by using [`Self::send_data()`], and to flush and +/// You can send [`MetricsData`] by using [`Self::send_data()`], and to flush and /// finish the connection use [`Self::join`]. /// /// If dropped, it will abort the connection and not flush out buffered data.