new method for extended info
parent
c2c5781f62
commit
3b5976b09c
|
|
@ -1,5 +1,5 @@
|
||||||
use deadpool_postgres::{Config, Pool, Runtime, Client as PgClient};
|
use deadpool_postgres::{Config, Pool, Runtime, Client as PgClient};
|
||||||
use integr_structs::api::v3::PrometheusMetrics;
|
use integr_structs::api::v3::{PrometheusMetrics, PrometheusMetricsExtended};
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use tokio_postgres::NoTls;
|
use tokio_postgres::NoTls;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
@ -67,5 +67,20 @@ impl Exporter {
|
||||||
req?;
|
req?;
|
||||||
Ok(metrics.get_bytes_len())
|
Ok(metrics.get_bytes_len())
|
||||||
}
|
}
|
||||||
|
pub async fn export_extended_metrics(metrics: PrometheusMetricsExtended) -> Result<usize> {
|
||||||
|
let url = env::var("EXPORTER_URL")?;
|
||||||
|
// let req = Request::new(Method::PUT,
|
||||||
|
// Url::parse(metrics)?);
|
||||||
|
// dbg!(&metrics);
|
||||||
|
let req = Client::new()
|
||||||
|
.post(url)
|
||||||
|
.json(&metrics)
|
||||||
|
.send().await;
|
||||||
|
// dbg!(&req);
|
||||||
|
// dbg!(&req.unwrap().text().await);
|
||||||
|
// todo : rewrite with status code wrapping
|
||||||
|
req?;
|
||||||
|
Ok(metrics.get_bytes_len())
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue