File tree 3 files changed +9
-5
lines changed
3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ use prometheus_exporter::{
10
10
} ,
11
11
} ;
12
12
13
- /// TODO COMMENTS ON SETUP
13
+ /// Contains metrics reporters for use in the overlay network
14
+ /// (eg. `portalnet/src/overlay.rs` & `portalnet/src/overlay_service.rs`).
15
+ /// Metric types reported here include protocol messages, utp transfers,
16
+ /// and content validation.
14
17
#[ derive( Clone ) ]
15
18
pub struct OverlayMetrics {
16
19
pub message_count : IntCounterVec ,
Original file line number Diff line number Diff line change 1
1
use crate :: metrics:: overlay:: OverlayMetrics ;
2
2
use crate :: metrics:: storage:: StorageMetrics ;
3
3
use lazy_static:: lazy_static;
4
- use prometheus_exporter:: prometheus:: Registry ;
4
+ use prometheus_exporter:: prometheus:: { default_registry , Registry } ;
5
5
6
6
lazy_static ! {
7
7
pub static ref PORTALNET_METRICS : PortalnetMetrics = initialize_metrics_registry( ) ;
8
8
}
9
9
10
10
fn initialize_metrics_registry ( ) -> PortalnetMetrics {
11
- let registry = Registry :: new ( ) ;
12
- PortalnetMetrics :: new ( registry) . expect ( "failed to initialize metrics" )
11
+ PortalnetMetrics :: new ( ) . expect ( "failed to initialize metrics" )
13
12
}
14
13
15
14
pub struct PortalnetMetrics {
@@ -18,7 +17,8 @@ pub struct PortalnetMetrics {
18
17
}
19
18
20
19
impl PortalnetMetrics {
21
- pub fn new ( registry : Registry ) -> anyhow:: Result < Self > {
20
+ pub fn new ( ) -> anyhow:: Result < Self > {
21
+ let registry = default_registry ( ) ;
22
22
let overlay = OverlayMetrics :: new ( & registry) ?;
23
23
let storage = StorageMetrics :: new ( & registry) ?;
24
24
Ok ( Self { overlay, storage } )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use prometheus_exporter::{
7
7
} ,
8
8
} ;
9
9
10
+ /// Contains metrics reporters for portalnet storage.
10
11
#[ derive( Clone , Debug ) ]
11
12
pub struct StorageMetrics {
12
13
pub content_storage_usage_bytes : GaugeVec ,
You can’t perform that action at this time.
0 commit comments