sequencer/persistence/
persistence_metrics.rs1use hotshot_types::traits::metrics::{Histogram, Metrics, NoMetrics};
2
3#[derive(Clone, Debug)]
5pub struct PersistenceMetricsValue {
6 pub internal_append_vid_duration: Box<dyn Histogram>,
8 pub internal_append_vid2_duration: Box<dyn Histogram>,
10 pub internal_append_da_duration: Box<dyn Histogram>,
12 pub internal_append_da2_duration: Box<dyn Histogram>,
14 pub internal_append_quorum2_duration: Box<dyn Histogram>,
16}
17
18impl PersistenceMetricsValue {
19 #[must_use]
21 pub fn new(metrics: &dyn Metrics) -> Self {
22 Self {
23 internal_append_vid_duration: metrics.create_histogram(
24 String::from("internal_append_vid_duration"),
25 Some("seconds".to_string()),
26 ),
27 internal_append_vid2_duration: metrics.create_histogram(
28 String::from("internal_append_vid2_duration"),
29 Some("seconds".to_string()),
30 ),
31 internal_append_da_duration: metrics.create_histogram(
32 String::from("internal_append_da_duration"),
33 Some("seconds".to_string()),
34 ),
35 internal_append_da2_duration: metrics.create_histogram(
36 String::from("internal_append_da2_duration"),
37 Some("seconds".to_string()),
38 ),
39 internal_append_quorum2_duration: metrics.create_histogram(
40 String::from("internal_append_quorum2_duration"),
41 Some("seconds".to_string()),
42 ),
43 }
44 }
45}
46
47impl Default for PersistenceMetricsValue {
48 fn default() -> Self {
49 Self::new(&*NoMetrics::boxed())
50 }
51}