use rill_protocol::config::ConfigPatch;
use rill_protocol::io::provider::PathPattern;
use serde::Deserialize;
use std::collections::HashSet;
pub static NODE: ConfigPatch<String> = ConfigPatch::new("VAR-NOT-SPECIFIED");
#[derive(Deserialize, Debug)]
pub struct ExportConfig {
pub prometheus: Option<PrometheusConfig>,
pub graphite: Option<GraphiteConfig>,
}
impl Default for ExportConfig {
fn default() -> Self {
Self {
prometheus: None,
graphite: None,
}
}
}
impl ExportConfig {
pub fn node_url(&self) -> String {
let host = NODE.get(|| None, || "localhost:9090".into());
format!("ws://{}/live/client", host)
}
}
#[derive(Deserialize, Debug)]
pub struct PrometheusConfig {
pub paths: HashSet<PathPattern>,
}
#[derive(Deserialize, Debug)]
pub struct GraphiteConfig {
pub paths: HashSet<PathPattern>,
pub interval: Option<u64>,
}