pub struct StatsRecord {
pub id: String,
pub timestamp: DateTime<Utc>,
pub source: String,
pub metrics: HashMap<String, MetricValue>,
pub duration: Option<Duration>,
pub metadata: HashMap<String, String>,
}
Expand description
Statistics record containing collected metrics
Fields§
§id: String
Unique identifier for this record
timestamp: DateTime<Utc>
When the statistics were collected
source: String
Source identifier
metrics: HashMap<String, MetricValue>
Collected metrics
duration: Option<Duration>
Duration of the measured operation
metadata: HashMap<String, String>
Additional metadata
Implementations§
Source§impl StatsRecord
impl StatsRecord
Sourcepub fn add_metric(&mut self, name: impl Into<String>, value: MetricValue)
pub fn add_metric(&mut self, name: impl Into<String>, value: MetricValue)
Add a metric to the record
Sourcepub fn set_duration(&mut self, duration: Duration)
pub fn set_duration(&mut self, duration: Duration)
Set the duration for the record
Trait Implementations§
Source§impl Clone for StatsRecord
impl Clone for StatsRecord
Source§fn clone(&self) -> StatsRecord
fn clone(&self) -> StatsRecord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for StatsRecord
impl Debug for StatsRecord
Source§impl<'de> Deserialize<'de> for StatsRecord
impl<'de> Deserialize<'de> for StatsRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<StatsRecord> for StatisticsData
impl From<StatsRecord> for StatisticsData
Source§fn from(record: StatsRecord) -> Self
fn from(record: StatsRecord) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StatsRecord
impl RefUnwindSafe for StatsRecord
impl Send for StatsRecord
impl Sync for StatsRecord
impl Unpin for StatsRecord
impl UnwindSafe for StatsRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more