Some structure changes
This commit is contained in:
parent
3dc30fedc2
commit
4c65056856
|
@ -5,19 +5,24 @@ use hdrhistogram::Histogram;
|
|||
use serde::de::Error;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use serde_bare::Uint;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
|
||||
pub fn get_supported_version() -> String {
|
||||
format!("bare-metrics:{}", env!("CARGO_PKG_VERSION"))
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Serialize, Deserialize, Default,
|
||||
)]
|
||||
pub struct UnixTimestampMilliseconds(pub u64);
|
||||
|
||||
/// Header for a metric log file.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
||||
pub struct LogHeader {
|
||||
/// String describing the version of this metrics log file.
|
||||
pub bare_metrics_version: String,
|
||||
/// Unix timestamp (milliseconds) describing the start of the metrics.
|
||||
pub start_time_ms: u64,
|
||||
pub start_time: UnixTimestampMilliseconds,
|
||||
}
|
||||
|
||||
/// A single frame of metrics.
|
||||
|
@ -26,7 +31,7 @@ pub struct LogHeader {
|
|||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
||||
pub struct Frame {
|
||||
/// Unix timestamp (milliseconds) describing the end of this frame of metrics.
|
||||
pub end_time_ms: u64,
|
||||
pub end_time: UnixTimestampMilliseconds,
|
||||
/// Absolute values of updated gauges.
|
||||
pub gauge_updates: HashMap<MetricId, f64>,
|
||||
/// Absolute values of updated counters.
|
||||
|
@ -53,6 +58,8 @@ pub struct MetricDescriptor {
|
|||
pub kind: MetricKind,
|
||||
pub unit: Option<String>,
|
||||
pub description: String,
|
||||
pub name: String,
|
||||
pub labels: BTreeMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
Loading…
Reference in New Issue