subbeat
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.

38 lines
861 B

use subbeat::datasources::grafana;
3 years ago
3 years ago
mod cli;
3 years ago
mod types;
3 years ago
#[tokio::main]
async fn main() -> types::Result<()> {
3 years ago
let cli = cli::CLI::new();
3 years ago
let gs = grafana::Grafana::new(
cli.query_config.url.to_string(),
cli.query_config.key.to_string(),
);
// gs.test_connection().await?;
// gs.get_datasources().await?;
3 years ago
// "http://localhost:3000/d/YeBxHjzWz/starter-app-stats?editPanel=2&orgId=1"
3 years ago
let r = gs
3 years ago
.extract_metrics(
&cli.query_config.datasource_url,
&cli.query_config.query,
cli.query_config.from,
cli.query_config.to,
cli.query_config.step,
)
3 years ago
.await?;
3 years ago
let key = r.data.keys().nth(0).unwrap();
3 years ago
println!("{}", key);
3 years ago
let vs = &r.data[key];
3 years ago
for (t, v) in vs.iter() {
println!("{}\t{}", t, v);
}
Ok(())
3 years ago
}