prometheus-exporter/src/structs.rs

28 lines
747 B
Rust

// use std::collections::HashMap;
use serde::{Serialize, Deserialize};
use serde_json::Value;
use std::borrow::Cow;
// use anyhow::Result;
// use std::sync::Arc;
pub mod v3 {
pub use super::*;
// to prometheus and nmns
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MetricOutput<'a> {
pub id : String,
#[serde(rename = "type")]
json_type : String,
addr : String,
pub value : Value,
#[serde(rename = "description")]
pub desc : Option<Cow<'a, String>>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct PrometheusMetrics<'a> {
pub service_name: String,
pub endpoint_name: String,
pub metrics: Vec<MetricOutput<'a>>,
}
}