clean up old stats

This commit is contained in:
beckerinj
2022-12-04 04:11:27 -05:00
parent 34b60c755b
commit 22a8845c53
3 changed files with 6 additions and 16 deletions

View File

@@ -1,13 +1,12 @@
use anyhow::{anyhow, Context};
use reqwest::StatusCode;
use serde::{de::DeserializeOwned, Serialize};
use types::Server;
use types::{Server, SystemStats};
mod build;
mod container;
mod git;
mod network;
mod stats;
pub struct PeripheryClient {
http_client: reqwest::Client,
@@ -32,6 +31,10 @@ impl PeripheryClient {
self.get_json(server, "/accounts/docker").await
}
pub async fn get_system_stats(&self, server: &Server) -> anyhow::Result<SystemStats> {
self.get_json(server, "/stats/system").await
}
async fn get_text(&self, server: &Server, endpoint: &str) -> anyhow::Result<String> {
let res = self
.http_client

View File

@@ -1,13 +0,0 @@
use types::{Server, SystemStats};
use crate::PeripheryClient;
impl PeripheryClient {
pub async fn get_system_stats(&self, server: &Server) -> anyhow::Result<SystemStats> {
self.get_json(server, "/stats/system").await
}
pub async fn get_docker_stats(&self, server: &Server) -> anyhow::Result<SystemStats> {
self.get_json(server, "/stats/docker").await
}
}

View File

@@ -24,4 +24,4 @@ impl Permissioned for Server {
fn permissions_map(&self) -> &PermissionsMap {
&self.permissions
}
}
}