1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use prometheus::{
default_registry, register_histogram_with_registry, register_int_counter_with_registry,
register_int_gauge_with_registry, Histogram, IntCounter, IntGauge, Registry,
};
#[derive(Clone, Debug)]
pub struct ExecutorMetrics {
pub tx_executor: IntGauge,
pub subscriber_local_fetch_latency: Histogram,
pub subscriber_remote_fetch_latency: Histogram,
pub subscriber_local_hit: IntCounter,
pub subscriber_recovered_certificates_count: IntCounter,
pub pending_remote_request_batch: IntGauge,
pub waiting_elements_subscriber: IntGauge,
}
impl ExecutorMetrics {
pub fn new(registry: &Registry) -> Self {
Self {
tx_executor: register_int_gauge_with_registry!(
"tx_executor",
"occupancy of the channel from the `Subscriber` to `Core`",
registry
)
.unwrap(),
subscriber_local_fetch_latency: register_histogram_with_registry!(
"subscriber_local_fetch_latency",
"Time it takes to download a payload from local worker peer",
vec![
0.005, 0.01, 0.02, 0.05, 0.1, 0.25, 0.5, 1.0, 2.0, 3.0, 5.0, 10.0, 20.0, 40.0,
60.0
],
registry
)
.unwrap(),
subscriber_remote_fetch_latency: register_histogram_with_registry!(
"subscriber_remote_fetch_latency",
"Time it takes to download a payload from remote worker peer",
vec![
0.005, 0.01, 0.02, 0.05, 0.1, 0.25, 0.5, 1.0, 2.0, 3.0, 5.0, 10.0, 20.0, 40.0,
60.0
],
registry
)
.unwrap(),
subscriber_recovered_certificates_count: register_int_counter_with_registry!(
"subscriber_recovered_certificates_count",
"The number of certificates processed by Subscriber during the recovery period to fetch their payloads",
registry
).unwrap(),
subscriber_local_hit: register_int_counter_with_registry!(
"subscriber_local_hit",
"Number of times certificate was found locally",
registry
).unwrap(),
pending_remote_request_batch: register_int_gauge_with_registry!(
"pending_remote_request_batch",
"The number of pending remote calls to request_batch",
registry
).unwrap(),
waiting_elements_subscriber: register_int_gauge_with_registry!(
"waiting_elements_subscriber",
"The number of pending payload downloads",
registry
).unwrap(),
}
}
}
impl Default for ExecutorMetrics {
fn default() -> Self {
Self::new(default_registry())
}
}