aranya_runtime/
metrics.rs1use core::time::Duration;
6
7pub trait Metrics {
9 type Error: core::error::Error + Send + Sync + 'static;
10
11 fn update(&mut self, name: &'static str, metric: Metric) -> Result<(), Self::Error>;
12}
13
14#[derive(Debug, Clone, PartialEq, Eq, Copy)]
15pub enum Metric {
16 Count(u64),
17 Duration(Duration),
18}
19
20#[derive(Debug, thiserror::Error)]
21pub enum MetricError {
22 #[error("metric type is incompatible")]
23 IncorrectType,
24 #[error("metric cannot be found")]
25 UnknownMetric,
26}