2 unstable releases

0.1.0 Jan 3, 2020
0.0.0 Dec 23, 2019

#1342 in Asynchronous

Download history 4/week @ 2024-02-18 37/week @ 2024-02-25 6/week @ 2024-03-03 8/week @ 2024-03-10

55 downloads per month

Apache-2.0/MIT

39KB
658 lines

Proq – Idiomatic Async Prometheus Query (PromQL) Client for Rust.

Build Status Latest Version Rust Documentation

This crate provides async client for Prometheus Query API. All queries can be written with PromQL notation. Timeout and protocol configuration can be passed at the client initiation time.

Adding as dependency

[dependencies]
proq = "0.1"

Basic Usage

use proq::prelude::*;
use std::time::Duration;

fn main() {
    let client = ProqClient::new(
        "localhost:9090",
        Some(Duration::from_secs(5)),
    ).unwrap();

    futures::executor::block_on(async {
        let end = Utc::now();
        let start = Some(end - chrono::Duration::minutes(1));
        let step = Some(Duration::from_secs_f64(1.5));

        let rangeq = client.range_query("up", start, Some(end), step).await;
    });
}

For more information please head to the Documentation.

Dependencies

~7MB
~162K SLoC