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.
22 lines
643 B
22 lines
643 B
use crate::{ |
|
metric::Metric, |
|
types::{DatasourceType, QueryConfig}, |
|
}; |
|
|
|
pub mod grafana; |
|
pub mod prometheus; |
|
|
|
pub fn resolve(query_config: &QueryConfig) -> Box<dyn Metric> { |
|
if query_config.datasource_type == DatasourceType::Grafana { |
|
let gs = grafana::Grafana::new( |
|
query_config.url.to_string(), |
|
query_config.key.to_string(), |
|
query_config.datasource_url.to_string(), |
|
query_config.query.to_string(), |
|
); |
|
return Box::new(gs); |
|
} else { |
|
let pm = prometheus::Prometheus::new(&query_config.url, &query_config.query); |
|
return Box::new(pm); |
|
} |
|
}
|
|
|