new method for extended info

feature/1117
prplV 2025-03-04 14:58:08 +03:00
parent c2c5781f62
commit 3b5976b09c
1 changed files with 16 additions and 1 deletions

View File

@ -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())
}
} }