Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/pbs/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ lazy_static! {
)
.unwrap();

/// Latest slot for which relay delivered a header
// Don't store slot number to avoid creating high cardinality, if needed can just aggregate for 12sec
pub static ref RELAY_HEADER_VALUE: IntGaugeVec = register_int_gauge_vec_with_registry!(
"relay_header_value",
"Header value in gwei delivered by relay",
&["relay_id"],
PBS_METRICS_REGISTRY
)
.unwrap();


// TO BEACON NODE
/// Status code returned to beacon node by endpoint
pub static ref BEACON_NODE_STATUS: IntCounterVec = register_int_counter_vec_with_registry!(
Expand Down
10 changes: 7 additions & 3 deletions crates/pbs/src/mev_boost/get_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use url::Url;

use crate::{
constants::{GET_HEADER_ENDPOINT_TAG, TIMEOUT_ERROR_CODE, TIMEOUT_ERROR_CODE_STR},
metrics::{RELAY_LAST_SLOT, RELAY_LATENCY, RELAY_STATUS_CODE},
metrics::{RELAY_HEADER_VALUE, RELAY_LAST_SLOT, RELAY_LATENCY, RELAY_STATUS_CODE},
state::{BuilderApiState, PbsState},
};

Expand Down Expand Up @@ -76,11 +76,15 @@ pub async fn get_header<S: BuilderApiState>(
let results = join_all(handles).await;
let mut relay_bids = Vec::with_capacity(relays.len());
for (i, res) in results.into_iter().enumerate() {
let relay_id = relays[i].id.as_ref();
let relay_id = relays[i].id.as_str();

match res {
Ok(Some(res)) => {
RELAY_LAST_SLOT.with_label_values(&[relay_id]).set(params.slot as i64);
let value_gwei =
(res.value() / U256::from(1_000_000_000)).try_into().unwrap_or_default();
RELAY_HEADER_VALUE.with_label_values(&[relay_id]).set(value_gwei);

relay_bids.push(res)
}
Ok(_) => {}
Expand Down Expand Up @@ -276,8 +280,8 @@ async fn send_one_get_header(

debug!(
latency = ?request_latency,
block_hash = %get_header_response.block_hash(),
value_eth = format_ether(get_header_response.value()),
block_hash = %get_header_response.block_hash(),
"received new header"
);

Expand Down
2 changes: 1 addition & 1 deletion crates/pbs/src/routes/get_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub async fn handle_get_header<S: BuilderApiState, A: BuilderApi<S>>(
state.publish_event(BuilderEvent::GetHeaderResponse(Box::new(res.clone())));

if let Some(max_bid) = res {
info!(block_hash =% max_bid.block_hash(), value_eth = format_ether(max_bid.value()), "received header");
info!(value_eth = format_ether(max_bid.value()), block_hash =% max_bid.block_hash(), "received header");

BEACON_NODE_STATUS.with_label_values(&["200", GET_HEADER_ENDPOINT_TAG]).inc();
Ok((StatusCode::OK, axum::Json(max_bid)).into_response())
Expand Down
79 changes: 77 additions & 2 deletions grafana/dashboards/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"id": 1,
"links": [],
"liveNow": true,
"panels": [
Expand Down Expand Up @@ -127,6 +127,81 @@
"title": "Last delivered slot",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "cb_prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "text",
"mode": "thresholds"
},
"decimals": 6,
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "percentage",
"steps": [
{
"color": "text",
"value": null
}
]
},
"unit": "ETH"
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 6,
"x": 6,
"y": 0
},
"id": 78,
"options": {
"colorMode": "none",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "cb_prometheus"
},
"disableTextWrap": false,
"editorMode": "code",
"exemplar": false,
"expr": "cb_pbs_relay_header_value / 1e9",
"format": "time_series",
"fullMetaSearch": false,
"includeNullMetadata": true,
"instant": false,
"legendFormat": "{{relay_id}}",
"range": true,
"refId": "A",
"useBackend": false
}
],
"title": "Last delivered header value",
"type": "stat"
},
{
"collapsed": false,
"gridPos": {
Expand Down Expand Up @@ -904,6 +979,6 @@
"timezone": "browser",
"title": "PBS Metrics",
"uid": "cb_pbs_metrics",
"version": 2,
"version": 1,
"weekStart": ""
}
77 changes: 76 additions & 1 deletion grafana/public_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,81 @@
"title": "Last delivered slot",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_CB_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "text",
"mode": "thresholds"
},
"decimals": 6,
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "percentage",
"steps": [
{
"color": "text",
"value": null
}
]
},
"unit": "ETH"
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 6,
"x": 6,
"y": 0
},
"id": 78,
"options": {
"colorMode": "none",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "11.1.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_CB_PROMETHEUS}"
},
"disableTextWrap": false,
"editorMode": "code",
"exemplar": false,
"expr": "cb_pbs_relay_header_value / 1e9",
"format": "time_series",
"fullMetaSearch": false,
"includeNullMetadata": true,
"instant": false,
"legendFormat": "{{relay_id}}",
"range": true,
"refId": "A",
"useBackend": false
}
],
"title": "Last delivered header value",
"type": "stat"
},
{
"collapsed": false,
"gridPos": {
Expand Down Expand Up @@ -913,6 +988,6 @@
"timezone": "browser",
"title": "PBS Metrics",
"uid": "cb_pbs_metrics",
"version": 2,
"version": 1,
"weekStart": ""
}