2
0
mirror of https://github.com/status-im/nimbus-eth1.git synced 2025-01-27 12:35:00 +00:00
Jordan Hrycaj f937f57838
Beacon sync targets cons head rather than finalised block ()
* Fix fringe condition clarifying how to handle an empty range

why:
  The `interval_set` module would treat an undefined interval construct
  `[2,1]` as`[2,2]` (the right bound being `max(2,1)`.)

* Use the `consensus head` rather than the `finalised` block as sync target

why:
  The former is ahead of the `finalised` block.

* In ctx descriptor rename `final` field to `target`

* Update docu, rename `F` -> `T`
2024-10-09 18:00:00 +00:00

70 lines
2.2 KiB
Nim

# Nimbus
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at
# https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at
# https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed
# except according to those terms.
{.push raises:[].}
import
pkg/metrics,
../../worker_desc,
".."/[db, blocks_staged, headers_staged]
declareGauge beacon_base, "" &
"Max block number of imported/executed blocks"
declareGauge beacon_coupler, "" &
"Max block number for header chain starting at genesis"
declareGauge beacon_dangling, "" &
"Starting/min block number for higher up headers chain"
declareGauge beacon_end, "" &
"Ending/max block number of higher up headers chain"
declareGauge beacon_target, "" &
"Block number of sync target (would be consensus header)"
declareGauge beacon_header_lists_staged, "" &
"Number of header list records staged for serialised processing"
declareGauge beacon_headers_unprocessed, "" &
"Number of block numbers ready to fetch and stage headers"
declareGauge beacon_block_lists_staged, "" &
"Number of block list records staged for importing"
declareGauge beacon_blocks_unprocessed, "" &
"Number of block numbers ready to fetch and stage block data"
declareGauge beacon_buddies, "" &
"Number of currently active worker instances"
template updateMetricsImpl*(ctx: BeaconCtxRef) =
metrics.set(beacon_base, ctx.dbStateBlockNumber().int64)
metrics.set(beacon_coupler, ctx.layout.coupler.int64)
metrics.set(beacon_dangling, ctx.layout.dangling.int64)
metrics.set(beacon_end, ctx.layout.endBn.int64)
metrics.set(beacon_target, ctx.lhc.target.header.number.int64)
metrics.set(beacon_header_lists_staged, ctx.headersStagedQueueLen())
metrics.set(beacon_headers_unprocessed,
(ctx.headersUnprocTotal() + ctx.headersUnprocBorrowed()).int64)
metrics.set(beacon_block_lists_staged, ctx.blocksStagedQueueLen())
metrics.set(beacon_blocks_unprocessed,
(ctx.blocksUnprocTotal() + ctx.blocksUnprocBorrowed()).int64)
metrics.set(beacon_buddies, ctx.pool.nBuddies)
# End