Hastic standalone https://hastic.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
660 B

use subbeat::metric::{Metric, MetricResult};
pub struct MetricService {
datasource: Box<dyn Metric + Sync + Send>,
}
impl Clone for MetricService {
fn clone(&self) -> Self {
return MetricService {
datasource: self.datasource.boxed_clone(),
};
}
}
impl MetricService {
pub fn new(ds_config: &subbeat::types::DatasourceConfig) -> MetricService {
MetricService {
datasource: subbeat::datasources::resolve(ds_config),
}
}
pub async fn query(&self, from: u64, to: u64, step: u64) -> anyhow::Result<MetricResult> {
return self.datasource.query(from, to, step).await;
}
}