mirror of
https://codeberg.org/icewind/prometheus-edge-detector.git
synced 2026-06-03 09:24:06 +02:00
name is optional
This commit is contained in:
parent
67e25175e2
commit
e6ee1042f2
1 changed files with 6 additions and 3 deletions
|
|
@ -1,9 +1,9 @@
|
|||
use err_derive::Error;
|
||||
use reqwest::Client;
|
||||
use serde::Deserialize;
|
||||
use std::cmp::{max, min};
|
||||
use std::time::SystemTime;
|
||||
use tokio::time::Duration;
|
||||
use std::cmp::{min, max};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
|
|
@ -50,7 +50,7 @@ struct QueryResultDataResult {
|
|||
#[derive(Debug, Clone, Deserialize)]
|
||||
struct QueryResultDataResultMetric {
|
||||
#[serde(rename = "__name__")]
|
||||
id: String,
|
||||
id: Option<String>,
|
||||
instance: String,
|
||||
job: String,
|
||||
}
|
||||
|
|
@ -135,7 +135,10 @@ impl EdgeDetector {
|
|||
query,
|
||||
start_time,
|
||||
end_time,
|
||||
min(60usize, max(2usize, (end_time as usize - start_time as usize) / 240)),
|
||||
min(
|
||||
60usize,
|
||||
max(2usize, (end_time as usize - start_time as usize) / 240),
|
||||
),
|
||||
)
|
||||
.await?
|
||||
.data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue