mirror of
https://codeberg.org/icewind/prometheus-edge-detector.git
synced 2026-06-03 17:34: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 err_derive::Error;
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use std::cmp::{max, min};
|
||||||
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 {
|
||||||
|
|
@ -50,7 +50,7 @@ struct QueryResultDataResult {
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
struct QueryResultDataResultMetric {
|
struct QueryResultDataResultMetric {
|
||||||
#[serde(rename = "__name__")]
|
#[serde(rename = "__name__")]
|
||||||
id: String,
|
id: Option<String>,
|
||||||
instance: String,
|
instance: String,
|
||||||
job: String,
|
job: String,
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,10 @@ impl EdgeDetector {
|
||||||
query,
|
query,
|
||||||
start_time,
|
start_time,
|
||||||
end_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?
|
.await?
|
||||||
.data
|
.data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue