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::de::Error;
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use serde_bare::Uint;
|
use serde_bare::Uint;
|
||||||
use std::collections::HashMap;
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
|
||||||
pub fn get_supported_version() -> String {
|
pub fn get_supported_version() -> String {
|
||||||
format!("bare-metrics:{}", env!("CARGO_PKG_VERSION"))
|
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.
|
/// Header for a metric log file.
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
||||||
pub struct LogHeader {
|
pub struct LogHeader {
|
||||||
/// String describing the version of this metrics log file.
|
/// String describing the version of this metrics log file.
|
||||||
pub bare_metrics_version: String,
|
pub bare_metrics_version: String,
|
||||||
/// Unix timestamp (milliseconds) describing the start of the metrics.
|
/// Unix timestamp (milliseconds) describing the start of the metrics.
|
||||||
pub start_time_ms: u64,
|
pub start_time: UnixTimestampMilliseconds,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single frame of metrics.
|
/// A single frame of metrics.
|
||||||
|
@ -26,7 +31,7 @@ pub struct LogHeader {
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
||||||
pub struct Frame {
|
pub struct Frame {
|
||||||
/// Unix timestamp (milliseconds) describing the end of this frame of metrics.
|
/// 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.
|
/// Absolute values of updated gauges.
|
||||||
pub gauge_updates: HashMap<MetricId, f64>,
|
pub gauge_updates: HashMap<MetricId, f64>,
|
||||||
/// Absolute values of updated counters.
|
/// Absolute values of updated counters.
|
||||||
|
@ -53,6 +58,8 @@ pub struct MetricDescriptor {
|
||||||
pub kind: MetricKind,
|
pub kind: MetricKind,
|
||||||
pub unit: Option<String>,
|
pub unit: Option<String>,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
pub name: String,
|
||||||
|
pub labels: BTreeMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|
Loading…
Reference in New Issue