all stats are sync now

This commit is contained in:
Robin Appelman 2021-03-28 22:33:01 +02:00
commit 289161fc6f
3 changed files with 2 additions and 5 deletions

View file

@ -2,11 +2,9 @@ use iai::black_box;
use palantir::get_metrics; use palantir::get_metrics;
use palantir::sensors::{cpu_time, disk_stats, disk_usage, memory, network_stats, temperatures}; use palantir::sensors::{cpu_time, disk_stats, disk_usage, memory, network_stats, temperatures};
use palantir::zfs::pools; use palantir::zfs::pools;
use tokio::runtime::Runtime;
fn iai_get_metrics() -> String { fn iai_get_metrics() -> String {
let rt = Runtime::new().unwrap(); black_box(get_metrics().unwrap())
rt.block_on(async { black_box(get_metrics().await.unwrap()) })
} }
fn iai_zfs_pool() { fn iai_zfs_pool() {

View file

@ -7,7 +7,7 @@ use crate::zfs::pools;
use color_eyre::Result; use color_eyre::Result;
use std::fmt::Write; use std::fmt::Write;
pub async fn get_metrics() -> Result<String> { pub fn get_metrics() -> Result<String> {
let disk_usage = disk_usage()?; let disk_usage = disk_usage()?;
let disks = disk_stats()?; let disks = disk_stats()?;
let cpu = cpu_time()?; let cpu = cpu_time()?;

View file

@ -17,7 +17,6 @@ impl Reject for ReportRejection {}
async fn serve_metrics() -> Result<String, Rejection> { async fn serve_metrics() -> Result<String, Rejection> {
get_metrics() get_metrics()
.await
.map_err(ReportRejection::from) .map_err(ReportRejection::from)
.map_err(warp::reject::custom) .map_err(warp::reject::custom)
} }