added monitoring doc comms
test-org/integration-module/pipeline/pr-rc This commit looks good
Details
test-org/integration-module/pipeline/pr-rc This commit looks good
Details
parent
96dc94bf0b
commit
267e90c972
|
|
@ -13,6 +13,31 @@ use integr_structs::api::v3::{MetricOutputExtended, PrometheusMetricsExtended};
|
|||
use log::{error, info, warn};
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// # Fn `get_metrics_from_monitoring`
|
||||
///
|
||||
/// A function to init pulling and exporting metrics mechanism
|
||||
/// from CM to Exporter. It spawns async tasks to get measures
|
||||
/// and their values and then extract needed info to export
|
||||
///
|
||||
/// ### Dev-Info :
|
||||
///
|
||||
/// *input* : duration and delay as `usize` (in secs)
|
||||
///
|
||||
/// *output* : `anyhow::Result<()>`
|
||||
///
|
||||
/// *initiator* : fn `main`
|
||||
///
|
||||
/// *managing* : runtime of N async tasks (N - count of chunks)
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use api-grub::monitoring::get_metrics_from_monitoring;
|
||||
///
|
||||
/// // exec func without time restriction but with delay in 5 secs
|
||||
/// assert_eq!(get_metrics_from_monitoring(0, 5).await, Ok(()));
|
||||
/// ```
|
||||
///
|
||||
pub async fn get_metrics_from_monitoring(duration: usize, delay: usize) -> anyhow::Result<()> {
|
||||
let timer = tokio::time::Instant::now();
|
||||
'outer: loop {
|
||||
|
|
@ -34,6 +59,23 @@ pub async fn get_metrics_from_monitoring(duration: usize, delay: usize) -> anyho
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// An entity which handle CM creds
|
||||
///
|
||||
/// Used to capture measures and there values, to preprocess all measures to
|
||||
/// relevant Exporter's structure
|
||||
///
|
||||
/// # Example:
|
||||
///
|
||||
/// ```
|
||||
/// use api-grub::monitoring::MonitoringImporter;
|
||||
///
|
||||
/// let mut a = MonitoringImporter::new().await;
|
||||
/// a.start_session().await?;
|
||||
/// let vec = Arc::new(a.get_metrics_list().await.unwrap_or_else(|_| vec![]));
|
||||
///
|
||||
/// assert_eq!(a.get_measure_info(vec.clone()).await, Ok(()));
|
||||
/// ```
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MonitoringImporter {
|
||||
ip : String,
|
||||
|
|
|
|||
Loading…
Reference in New Issue