#prometheus #edge #dropping #detector #find #most #query

prometheus-edge-detector

Find the most recent rising or dropping edge from a prometheus query

2 unstable releases

0.3.0 Feb 12, 2024
0.2.0 Jan 6, 2021

#3 in #dropping

Download history 20/week @ 2024-02-06 26/week @ 2024-02-13 26/week @ 2024-02-20 76/week @ 2024-02-27 1/week @ 2024-03-05 5/week @ 2024-03-12

112 downloads per month

MIT/Apache

18KB
157 lines

Prometheus edge detector

Find the most recent rising or dropping edge from a prometheus query

Usage

use main_error::MainError;
use prometheus_edge_detector::EdgeDetector;
use tokio::time::Duration;

#[tokio::main]
async fn main() -> Result<(), MainError> {
    let edge_detector = EdgeDetector::new("http://example.com");
    let edge = edge_detector
        .get_last_edge("prometheus_value", 1, 0, Duration::from_secs(60 * 60))
        .await?;

    if let Some(edge_time) = edge {
        print!("Last dropping edge: {}", edge_time);
    } else {
        println!("Query doesn't end with dropping edge");
    }

    Ok(())
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~6–21MB
~324K SLoC