|
1 | 1 | //! Metrics for iroh-docs
|
2 | 2 |
|
3 |
| -use iroh_metrics::{ |
4 |
| - core::{Counter, Metric}, |
5 |
| - struct_iterable::Iterable, |
6 |
| -}; |
| 3 | +use iroh_metrics::{Counter, MetricsGroup}; |
7 | 4 |
|
8 | 5 | /// Metrics for iroh-docs
|
9 |
| -#[allow(missing_docs)] |
10 |
| -#[derive(Debug, Clone, Iterable)] |
| 6 | +#[derive(Debug, Default, MetricsGroup)] |
11 | 7 | pub struct Metrics {
|
| 8 | + /// Number of document entries added locally |
12 | 9 | pub new_entries_local: Counter,
|
| 10 | + /// Number of document entries added by peers |
13 | 11 | pub new_entries_remote: Counter,
|
| 12 | + /// Total size of entry contents added locally |
14 | 13 | pub new_entries_local_size: Counter,
|
| 14 | + /// Total size of entry contents added by peers |
15 | 15 | pub new_entries_remote_size: Counter,
|
16 |
| - pub sync_via_connect_success: Counter, |
17 |
| - pub sync_via_connect_failure: Counter, |
| 16 | + /// Number of successful syncs (via accept) |
18 | 17 | pub sync_via_accept_success: Counter,
|
| 18 | + /// Number of failed syncs (via accept) |
19 | 19 | pub sync_via_accept_failure: Counter,
|
| 20 | + /// Number of successful syncs (via connect) |
| 21 | + pub sync_via_connect_success: Counter, |
| 22 | + /// Number of failed syncs (via connect) |
| 23 | + pub sync_via_connect_failure: Counter, |
20 | 24 |
|
| 25 | + /// Number of times the main actor loop ticked |
21 | 26 | pub actor_tick_main: Counter,
|
22 | 27 |
|
| 28 | + /// Number of times the gossip actor loop ticked |
23 | 29 | pub doc_gossip_tick_main: Counter,
|
| 30 | + /// Number of times the gossip actor processed an event |
24 | 31 | pub doc_gossip_tick_event: Counter,
|
| 32 | + /// Number of times the gossip actor processed an actor event |
25 | 33 | pub doc_gossip_tick_actor: Counter,
|
| 34 | + /// Number of times the gossip actor processed a pending join |
26 | 35 | pub doc_gossip_tick_pending_join: Counter,
|
27 | 36 |
|
| 37 | + /// Number of times the live actor loop ticked |
28 | 38 | pub doc_live_tick_main: Counter,
|
| 39 | + /// Number of times the live actor processed an actor event |
29 | 40 | pub doc_live_tick_actor: Counter,
|
| 41 | + /// Number of times the live actor processed a replica event |
30 | 42 | pub doc_live_tick_replica_event: Counter,
|
| 43 | + /// Number of times the live actor processed a running sync connect |
31 | 44 | pub doc_live_tick_running_sync_connect: Counter,
|
| 45 | + /// Number of times the live actor processed a running sync accept |
32 | 46 | pub doc_live_tick_running_sync_accept: Counter,
|
| 47 | + /// Number of times the live actor processed a pending download |
33 | 48 | pub doc_live_tick_pending_downloads: Counter,
|
34 | 49 | }
|
35 |
| - |
36 |
| -impl Default for Metrics { |
37 |
| - fn default() -> Self { |
38 |
| - Self { |
39 |
| - new_entries_local: Counter::new("Number of document entries added locally"), |
40 |
| - new_entries_remote: Counter::new("Number of document entries added by peers"), |
41 |
| - new_entries_local_size: Counter::new("Total size of entry contents added locally"), |
42 |
| - new_entries_remote_size: Counter::new("Total size of entry contents added by peers"), |
43 |
| - sync_via_accept_success: Counter::new("Number of successful syncs (via accept)"), |
44 |
| - sync_via_accept_failure: Counter::new("Number of failed syncs (via accept)"), |
45 |
| - sync_via_connect_success: Counter::new("Number of successful syncs (via connect)"), |
46 |
| - sync_via_connect_failure: Counter::new("Number of failed syncs (via connect)"), |
47 |
| - |
48 |
| - actor_tick_main: Counter::new("Number of times the main actor loop ticked"), |
49 |
| - |
50 |
| - doc_gossip_tick_main: Counter::new("Number of times the gossip actor loop ticked"), |
51 |
| - doc_gossip_tick_event: Counter::new( |
52 |
| - "Number of times the gossip actor processed an event", |
53 |
| - ), |
54 |
| - doc_gossip_tick_actor: Counter::new( |
55 |
| - "Number of times the gossip actor processed an actor event", |
56 |
| - ), |
57 |
| - doc_gossip_tick_pending_join: Counter::new( |
58 |
| - "Number of times the gossip actor processed a pending join", |
59 |
| - ), |
60 |
| - |
61 |
| - doc_live_tick_main: Counter::new("Number of times the live actor loop ticked"), |
62 |
| - doc_live_tick_actor: Counter::new( |
63 |
| - "Number of times the live actor processed an actor event", |
64 |
| - ), |
65 |
| - doc_live_tick_replica_event: Counter::new( |
66 |
| - "Number of times the live actor processed a replica event", |
67 |
| - ), |
68 |
| - doc_live_tick_running_sync_connect: Counter::new( |
69 |
| - "Number of times the live actor processed a running sync connect", |
70 |
| - ), |
71 |
| - doc_live_tick_running_sync_accept: Counter::new( |
72 |
| - "Number of times the live actor processed a running sync accept", |
73 |
| - ), |
74 |
| - doc_live_tick_pending_downloads: Counter::new( |
75 |
| - "Number of times the live actor processed a pending download", |
76 |
| - ), |
77 |
| - } |
78 |
| - } |
79 |
| -} |
80 |
| - |
81 |
| -impl Metric for Metrics { |
82 |
| - fn name() -> &'static str { |
83 |
| - "iroh_docs" |
84 |
| - } |
85 |
| -} |
0 commit comments