micromegas_tracing/metrics/
metric_events.rs

1use crate::property_set::PropertySet;
2use micromegas_transit::prelude::*;
3
4use super::StaticMetricMetadata;
5
6/// Wire format reprensenting an instance of [StaticMetricMetadata]
7#[derive(Debug, TransitReflect)]
8pub struct MetricMetadataDependency {
9    pub id: u64,
10    pub name: *const u8,
11    pub unit: *const u8,
12    pub target: *const u8,
13    pub file: *const u8,
14    pub line: u32,
15    pub lod: u32,
16}
17
18impl InProcSerialize for MetricMetadataDependency {}
19
20/// Measure (int) with static metadata
21/// Will be converted to a floating point value when processed by the analytics library
22#[derive(Debug, TransitReflect)]
23pub struct IntegerMetricEvent {
24    pub desc: &'static StaticMetricMetadata,
25    pub value: u64,
26    pub time: i64,
27}
28
29impl InProcSerialize for IntegerMetricEvent {}
30
31/// Measure (float) with static metadata
32#[derive(Debug, TransitReflect)]
33pub struct FloatMetricEvent {
34    pub desc: &'static StaticMetricMetadata,
35    pub value: f64,
36    pub time: i64,
37}
38
39impl InProcSerialize for FloatMetricEvent {}
40
41/// Measure (float) with a dynamic set of properties
42#[derive(Debug, TransitReflect)]
43pub struct TaggedFloatMetricEvent {
44    pub desc: &'static StaticMetricMetadata,
45    pub properties: &'static PropertySet,
46    pub value: f64,
47    pub time: i64,
48}
49
50impl InProcSerialize for TaggedFloatMetricEvent {}
51
52/// Measure (int) with a dynamic set of properties
53#[derive(Debug, TransitReflect)]
54pub struct TaggedIntegerMetricEvent {
55    pub desc: &'static StaticMetricMetadata,
56    pub properties: &'static PropertySet,
57    pub value: u64,
58    pub time: i64,
59}
60
61impl InProcSerialize for TaggedIntegerMetricEvent {}