#13 fixed, sessions now recreating
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
9de3aa1629
commit
e4d58696c0
|
|
@ -40,19 +40,26 @@ use std::collections::HashMap;
|
||||||
///
|
///
|
||||||
pub async fn get_metrics_from_monitoring(duration: usize, delay: usize) -> anyhow::Result<()> {
|
pub async fn get_metrics_from_monitoring(duration: usize, delay: usize) -> anyhow::Result<()> {
|
||||||
let timer = tokio::time::Instant::now();
|
let timer = tokio::time::Instant::now();
|
||||||
|
let mut a = MonitoringImporter::new().await;
|
||||||
'outer: loop {
|
'outer: loop {
|
||||||
let mut a = MonitoringImporter::new().await;
|
// let mut a = MonitoringImporter::new().await;
|
||||||
a.start_session().await?;
|
a.start_session().await?;
|
||||||
|
info!("Started a new CM session");
|
||||||
|
|
||||||
let vec = Arc::new(a.get_metrics_list().await.unwrap_or_else(|_| vec![]));
|
let vec = Arc::new(a.get_metrics_list().await.unwrap_or_else(|_| vec![]));
|
||||||
|
|
||||||
'inner: loop {
|
'inner: loop {
|
||||||
if duration != 0 && timer.elapsed() >= tokio::time::Duration::from_secs(duration as u64) {
|
if duration != 0 && timer.elapsed() >= tokio::time::Duration::from_secs(duration as u64) {
|
||||||
break 'outer;
|
break 'outer;
|
||||||
}
|
}
|
||||||
if let Err(_) = a.get_measure_info(vec.clone()).await {
|
if vec.len() == 0 || a.get_measure_info(vec.clone()).await.is_err() {
|
||||||
warn!("Session dropped, creating new ...");
|
warn!("Session dropped, creating new ...");
|
||||||
break 'inner;
|
break 'inner;
|
||||||
}
|
}
|
||||||
|
// if let Err(_) = a.get_measure_info(vec.clone()).await {
|
||||||
|
// warn!("Session dropped, creating new ...");
|
||||||
|
// break 'inner;
|
||||||
|
// }
|
||||||
tokio::time::sleep(tokio::time::Duration::from_secs(delay as u64)).await
|
tokio::time::sleep(tokio::time::Duration::from_secs(delay as u64)).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -235,14 +242,15 @@ impl MonitoringImporter {
|
||||||
for event in jh_vec {
|
for event in jh_vec {
|
||||||
match event.await {
|
match event.await {
|
||||||
Ok(val) => {
|
Ok(val) => {
|
||||||
if let Ok(val) = val {
|
match crate::export::Exporter::export_extended_metrics(val?).await {
|
||||||
match crate::export::Exporter::export_extended_metrics(val).await {
|
Ok(bytes) => {info!("Successfully transmitted {} bytes to the Prometehus exporter", bytes)},
|
||||||
Ok(bytes) => {info!("Successfully transmitted {} bytes to the Prometehus exporter", bytes)},
|
Err(er) => error!("Cannot export data to the Prometehus exporter due to : `{}`", er),
|
||||||
Err(er) => error!("Cannot export data to the Prometehus exporter due to : `{}`", er),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(er) => println!("Fatal error on async task: {}", er),
|
Err(er) => {
|
||||||
|
println!("Fatal error on async task: {}", er);
|
||||||
|
return Err(anyhow::Error::msg(format!("Fatal error on async task: {}", er)))
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue