micromegas_telemetry/
block_wire_format.rs

1// block wire format
2use serde::{Deserialize, Serialize};
3
4/// Payload sent by instrumented processes, containing serialized dependencies and objects.
5///
6/// The `dependencies` field contains the serialized data for all the
7/// `UserDefinedType` that are required to deserialize the `objects`.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct BlockPayload {
10    pub dependencies: Vec<u8>,
11    pub objects: Vec<u8>,
12}
13
14/// Block metadata sent by instrumented processes.
15///
16/// A block represents a chunk of telemetry data from a single stream.
17/// It contains timing information, references to the process and stream,
18/// and the actual payload of telemetry events.
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct Block {
21    #[serde(
22        deserialize_with = "micromegas_transit::uuid_utils::uuid_from_string",
23        serialize_with = "micromegas_transit::uuid_utils::uuid_to_string"
24    )]
25    pub block_id: uuid::Uuid,
26    #[serde(
27        deserialize_with = "micromegas_transit::uuid_utils::uuid_from_string",
28        serialize_with = "micromegas_transit::uuid_utils::uuid_to_string"
29    )]
30    pub stream_id: uuid::Uuid,
31    #[serde(
32        deserialize_with = "micromegas_transit::uuid_utils::uuid_from_string",
33        serialize_with = "micromegas_transit::uuid_utils::uuid_to_string"
34    )]
35    pub process_id: uuid::Uuid,
36    /// we send both RFC3339 times and ticks to be able to calibrate the tick
37    pub begin_time: String,
38    pub begin_ticks: i64,
39    pub end_time: String,
40    pub end_ticks: i64,
41    pub payload: BlockPayload,
42    pub object_offset: i64,
43    pub nb_objects: i32,
44}