Skip to content
Snippets Groups Projects
Commit 5420e207 authored by Maaz Ahmed's avatar Maaz Ahmed
Browse files

chore: simple code example in README

parent 9ce43f13
No related branches found
No related tags found
No related merge requests found
# mquery (placeholder name) # mquery (placeholder name)
A Rust library for handling PROMQL (and possibly MetricsQL) queries. A Rust library for handling PROMQL (and possibly MetricsQL) queries.
# Usage Example ## Usage Example
```rust ```rust
use mquery::{Auth, QueryManager}; use mquery::{Auth, QueryManager};
use tokio::runtime::Runtime;
dotenv::dotenv().expect("No .env file found in working dir"); #[tokio::main]
let url = std::env::var("VM_URL").expect("VM URL not found in env"); async fn main() {
let token = std::env::var("VM_TOKEN").expect("VM URL not found in env"); dotenv::dotenv().expect("No .env file found in working dir");
let rt = Runtime::new().unwrap(); let url = std::env::var("VM_URL").expect("VM URL not found in env");
let query = "total_http_requests"; let token = std::env::var("VM_TOKEN").expect("VM URL not found in env");
let _response = rt let query = "total_http_requests";
.block_on(
QueryManager::new(url.parse().unwrap()) let _response = QueryManager::new(url.parse().unwrap())
.auth(Auth::Bearer(token)) .auth(Auth::Bearer(token))
.query(query), .query(query)
) .await
.expect("operation failed"); .expect("operation failed");
} }
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment