Find the most recent rising or dropping edge from a prometheus query
  • Rust 92.5%
  • Nix 7.5%
Find a file
2020-01-11 14:56:32 +01:00
examples initial version 2020-01-11 14:56:32 +01:00
src initial version 2020-01-11 14:56:32 +01:00
.gitignore init repo 2020-01-10 18:15:22 +01:00
Cargo.toml initial version 2020-01-11 14:56:32 +01:00
LICENSE-APACHE initial version 2020-01-11 14:56:32 +01:00
LICENSE-MIT initial version 2020-01-11 14:56:32 +01:00
README.md initial version 2020-01-11 14:56:32 +01:00

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.