diff options
author | metamuffin <metamuffin@disroot.org> | 2024-05-29 16:37:44 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-05-29 16:37:44 +0200 |
commit | 886a18e0c67624d0882f04c7f6659bcfee6b4d8d (patch) | |
tree | 32a5389076b199c4e06fa10ce6b54d165d5466c5 /src/reporting.rs | |
parent | 6cebab912dcf01bbe225c20ec2e7656f61ba160e (diff) | |
download | gnix-886a18e0c67624d0882f04c7f6659bcfee6b4d8d.tar gnix-886a18e0c67624d0882f04c7f6659bcfee6b4d8d.tar.bz2 gnix-886a18e0c67624d0882f04c7f6659bcfee6b4d8d.tar.zst |
refactor filter system
Diffstat (limited to 'src/reporting.rs')
-rw-r--r-- | src/reporting.rs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/reporting.rs b/src/reporting.rs deleted file mode 100644 index ee30ac5..0000000 --- a/src/reporting.rs +++ /dev/null @@ -1,39 +0,0 @@ -use crate::config::Config; -use mond_client::{make_ident, Aspect, Push, Rate, Reporter}; -use std::{collections::HashMap, marker::PhantomData}; - -pub struct Reporting { - pub request_in: Aspect<Rate<i64>>, - pub request_out: Aspect<Rate<i64>>, - pub hosts: HashMap<String, HostReporting>, - // pub connections: Aspect<State<i64>>, -} -pub struct HostReporting { - pub requests_in: Aspect<Rate<i64>>, -} - -impl Reporting { - pub fn new(config: &Config) -> Self { - let mut rep = Reporter::new(); - Self { - request_in: rep.create(make_ident!("requests-in"), Push(Rate(PhantomData::<i64>))), - request_out: rep.create(make_ident!("requests-out"), Push(Rate(PhantomData::<i64>))), - // connections: rep.create(make_ident!("connections"), Push()), - hosts: config - .hosts - .iter() - .map(|(k, _v)| { - ( - k.to_owned(), - HostReporting { - requests_in: rep.create( - make_ident!("host", k, "request-in"), - Push(Rate(PhantomData::<i64>)), - ), - }, - ) - }) - .collect(), - } - } -} |