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.

37 lines
747 B

3 years ago
use subbeat::grafana_service;
3 years ago
mod types;
3 years ago
mod cli;
3 years ago
#[tokio::main]
async fn main() -> types::Result<()> {
3 years ago
3 years ago
let cli = cli::CLI::new();
3 years ago
let gs = grafana_service::GrafanaService::new(cli.url.to_string(), cli.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
.extract_metrics(
3 years ago
&cli.datasource_url,
&cli.query,
cli.from,
cli.to,
3 years ago
15,
)
3 years ago
.await?;
3 years ago
let key = r.keys().nth(0).unwrap();
println!("{}", key);
let vs = &r[key];
for (t, v) in vs.iter() {
println!("{}\t{}", t, v);
}
Ok(())
3 years ago
}