Compare commits

...

3 Commits

Author SHA1 Message Date
Vladislav Drozdov 76beff02ac Merge pull request 'or_else + ? logic to handle two-step env var check' (#23) from hotfix/1307 into rc
test-org/integration-module/pipeline/pr-master Build succeeded
Reviewed-on: http://git.enode/deployer3000/integration-module/pulls/23
Reviewed-by: DmitriyA <faleo1999@mail.ru>
2025-04-28 10:25:35 +03:00
prplV fa0895122c extended log
test-org/integration-module/pipeline/pr-rc This commit looks good Details
2025-04-14 05:18:25 -04:00
prplV 91ead7d1ba or_else + ? logic to handle two-step env var check 2025-04-14 05:13:00 -04:00
2 changed files with 8 additions and 4 deletions

View File

@ -4,7 +4,7 @@ use reqwest::Client;
use tokio_postgres::NoTls;
use std::env;
use anyhow::Result;
use tracing::{debug, error, info};
use tracing::{debug, error, info, trace};
use std::ops::Drop;
/// An entity which handles DB connections.
@ -113,9 +113,13 @@ impl Exporter {
}
/// Exports metrics in `PrometheusMetricsExtended` format to Exporter defined
/// as env var $EXORPTER_URL
#[tracing::instrument(name = "Prometheus/Status System export")]
pub async fn export_extended_metrics(metrics: PrometheusMetricsExtended) -> Result<usize> {
// let url = env::var("EXPORTER_URL")?;
let url = env::var("STATUS_SYSTEM_URL").unwrap_or(env::var("EXPORTER_URL")?);
let url = env::var("STATUS_SYSTEM_URL").or_else(|err| {
trace!("cannot fetch $STATUS_SYSTEM_URL var due to {}. working only with Prometheus exporter link", err);
env::var("EXPORTER_URL")
})?;
debug!("Exporting: {:?}", &metrics);

View File

@ -277,8 +277,8 @@ impl MonitoringImporter {
match event.await {
Ok(val) => {
match crate::export::Exporter::export_extended_metrics(val?).await {
Ok(bytes) => {info!("Successfully transmitted {} bytes to the Prometehus exporter", bytes)},
Err(er) => error!("Cannot export data to the Prometehus exporter due to : `{}`", er),
Ok(bytes) => {info!("Successfully transmitted {} bytes", bytes)},
Err(er) => error!("Cannot export data due to : `{}`", er),
}
},
Err(er) => {