mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Improve logging and metrics for block publication (#5699)
* Improve logging and metrics for block publication * Add better buckets * Bump SQL connection timeout for tests.
This commit is contained in:
@@ -31,7 +31,13 @@ lazy_static::lazy_static! {
|
||||
);
|
||||
pub static ref HTTP_API_BLOCK_BROADCAST_DELAY_TIMES: Result<HistogramVec> = try_create_histogram_vec(
|
||||
"http_api_block_broadcast_delay_times",
|
||||
"Time between start of the slot and when the block was broadcast",
|
||||
"Time between start of the slot and when the block completed broadcast and processing",
|
||||
&["provenance"]
|
||||
);
|
||||
pub static ref HTTP_API_BLOCK_GOSSIP_TIMES: Result<HistogramVec> = try_create_histogram_vec_with_buckets(
|
||||
"http_api_block_gossip_times",
|
||||
"Time between receiving the block on HTTP and publishing it on gossip",
|
||||
decimal_buckets(-2, 2),
|
||||
&["provenance"]
|
||||
);
|
||||
pub static ref HTTP_API_BLOCK_PUBLISHED_LATE_TOTAL: Result<IntCounter> = try_create_int_counter(
|
||||
|
||||
@@ -60,6 +60,11 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlockConten
|
||||
ProvenancedBlock::Local(block_contents, _) => (block_contents, true),
|
||||
ProvenancedBlock::Builder(block_contents, _) => (block_contents, false),
|
||||
};
|
||||
let provenance = if is_locally_built_block {
|
||||
"local"
|
||||
} else {
|
||||
"builder"
|
||||
};
|
||||
let block = block_contents.inner_block().clone();
|
||||
let delay = get_block_delay_ms(seen_timestamp, block.message(), &chain.slot_clock);
|
||||
debug!(log, "Signed block received in HTTP API"; "slot" => block.slot());
|
||||
@@ -75,7 +80,18 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlockConten
|
||||
.checked_sub(seen_timestamp)
|
||||
.unwrap_or_else(|| Duration::from_secs(0));
|
||||
|
||||
info!(log, "Signed block published to network via HTTP API"; "slot" => block.slot(), "publish_delay" => ?publish_delay);
|
||||
metrics::observe_timer_vec(
|
||||
&metrics::HTTP_API_BLOCK_GOSSIP_TIMES,
|
||||
&[provenance],
|
||||
publish_delay,
|
||||
);
|
||||
|
||||
info!(
|
||||
log,
|
||||
"Signed block published to network via HTTP API";
|
||||
"slot" => block.slot(),
|
||||
"publish_delay_ms" => publish_delay.as_millis()
|
||||
);
|
||||
|
||||
match block.as_ref() {
|
||||
SignedBeaconBlock::Base(_)
|
||||
|
||||
Reference in New Issue
Block a user