-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
134 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub(crate) const STATUS_ENDPOINT_TAG: &str = "status"; | ||
pub(crate) const REGISTER_VALIDATOR_ENDPOINT_TAG: &str = "register_validator"; | ||
pub(crate) const SUBMIT_BLINDED_BLOCK_ENDPOINT_TAG: &str = "submit_blinded_block"; | ||
pub(crate) const GET_HEADER_ENDPOINT_TAG: &str = "get_header"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,43 @@ | ||
//! Metrics for PBS module | ||
//! We collect two types of metrics within the PBS module: | ||
//! - what PBS receives from relays | ||
//! - what PBS returns to the beacon node | ||
|
||
use lazy_static::lazy_static; | ||
use prometheus::{histogram_opts, opts, HistogramVec, IntCounterVec, Registry}; | ||
use prometheus::{ | ||
register_histogram_vec_with_registry, register_int_counter_vec_with_registry, HistogramVec, | ||
IntCounterVec, Registry, | ||
}; | ||
|
||
lazy_static! { | ||
pub static ref PBS_METRICS_REGISTRY: prometheus::Registry = | ||
pub static ref PBS_METRICS_REGISTRY: Registry = | ||
Registry::new_custom(Some("cb_pbs".to_string()), None).unwrap(); | ||
pub static ref REQUESTS_RECEIVED: IntCounterVec = | ||
IntCounterVec::new(opts!("requests_received", "Number of requests received"), &[ | ||
"endpoint", | ||
]) | ||
.unwrap(); | ||
pub static ref RELAY_RESPONSES: IntCounterVec = | ||
IntCounterVec::new(opts!("relay_response", "Number of requests received"), &[ | ||
"code", "endpoint", "relay_id" | ||
]) | ||
.unwrap(); | ||
pub static ref RELAY_RESPONSE_TIME: HistogramVec = | ||
HistogramVec::new(histogram_opts!("relay_response_time", "Relay response times"), &[ | ||
"endpoint", "relay_id" | ||
]) | ||
.unwrap(); | ||
} | ||
|
||
// TODO: this can be done with the macros, need to fix the types | ||
pub fn register_default_metrics() { | ||
PBS_METRICS_REGISTRY.register(Box::new(REQUESTS_RECEIVED.clone())).expect("failed to register"); | ||
// FROM RELAYS | ||
/// Status code received by relay by endpoint | ||
pub static ref RELAY_STATUS_CODE: IntCounterVec = register_int_counter_vec_with_registry!( | ||
"relay_status_code", | ||
"HTTP status code received by relay", | ||
&["http_status_code", "endpoint", "relay_id"], | ||
PBS_METRICS_REGISTRY | ||
) | ||
.unwrap(); | ||
|
||
PBS_METRICS_REGISTRY.register(Box::new(RELAY_RESPONSES.clone())).expect("failed to register"); | ||
/// Latency by relay by endpoint | ||
pub static ref RELAY_LATENCY: HistogramVec = register_histogram_vec_with_registry!( | ||
"relay_latency", | ||
"HTTP latency by relay", | ||
&["endpoint", "relay_id"], | ||
PBS_METRICS_REGISTRY | ||
) | ||
.unwrap(); | ||
|
||
PBS_METRICS_REGISTRY | ||
.register(Box::new(RELAY_RESPONSE_TIME.clone())) | ||
.expect("failed to register"); | ||
// TO BEACON NODE | ||
/// Status code returned to beacon node by endpoint | ||
pub static ref BEACON_NODE_STATUS: IntCounterVec = register_int_counter_vec_with_registry!( | ||
"beacon_node_status_code", | ||
"HTTP status code returned to beacon node", | ||
&["http_status_code", "endpoint"], | ||
PBS_METRICS_REGISTRY | ||
).unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.