feldera-types 0.283.0

Public API types for Feldera
Documentation
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

/// Time series to make graphs in the web console easier.
#[derive(Clone, Debug, Serialize, Deserialize, ToSchema, PartialEq, Eq)]
pub struct TimeSeries {
    /// Current time as of the creation of the structure.
    #[serde(with = "chrono::serde::ts_milliseconds")]
    pub now: DateTime<Utc>,

    /// Time series.
    ///
    /// These report 60 seconds of samples, one per second.
    pub samples: Vec<SampleStatistics>,
}

/// One sample of time-series data.
#[derive(Copy, Clone, Debug, Serialize, Deserialize, ToSchema, PartialEq, Eq)]
pub struct SampleStatistics {
    /// Sample time.
    #[serde(with = "chrono::serde::ts_milliseconds")]
    #[serde(rename = "t")]
    pub time: DateTime<Utc>,

    /// Records processed.
    #[serde(rename = "r")]
    pub total_processed_records: u64,

    /// Memory usage in bytes.
    #[serde(rename = "m")]
    pub memory_bytes: u64,

    /// Storage usage in bytes.
    #[serde(rename = "s")]
    pub storage_bytes: u64,
}