mirror of
https://codeberg.org/icewind/prometheus-edge-detector.git
synced 2026-06-03 09:24:06 +02:00
better step size for small intervals
This commit is contained in:
parent
a3d07677c8
commit
2f2fc8615d
1 changed files with 2 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ use reqwest::Client;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
use tokio::time::Duration;
|
use tokio::time::Duration;
|
||||||
|
use std::cmp::{min, max};
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
|
|
@ -134,7 +135,7 @@ impl EdgeDetector {
|
||||||
query,
|
query,
|
||||||
start_time,
|
start_time,
|
||||||
end_time,
|
end_time,
|
||||||
60,
|
min(60usize, max(2usize, (end_time as usize - start_time as usize) / 240)),
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
.data
|
.data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue