mirror of
https://codeberg.org/icewind/prometheus-edge-detector.git
synced 2026-06-03 09:24:06 +02:00
all metrics are optional
This commit is contained in:
parent
e6ee1042f2
commit
5a566f0197
1 changed files with 2 additions and 9 deletions
11
src/lib.rs
11
src/lib.rs
|
|
@ -2,6 +2,7 @@ use err_derive::Error;
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
use tokio::time::Duration;
|
use tokio::time::Duration;
|
||||||
|
|
||||||
|
|
@ -43,18 +44,10 @@ struct QueryResultData {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
struct QueryResultDataResult {
|
struct QueryResultDataResult {
|
||||||
metric: QueryResultDataResultMetric,
|
metric: HashMap<String, String>,
|
||||||
values: Vec<QueryResultDataResultValue>,
|
values: Vec<QueryResultDataResultValue>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
|
||||||
struct QueryResultDataResultMetric {
|
|
||||||
#[serde(rename = "__name__")]
|
|
||||||
id: Option<String>,
|
|
||||||
instance: String,
|
|
||||||
job: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
struct QueryResultDataResultValue(u64, String);
|
struct QueryResultDataResultValue(u64, String);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue