Jordan Hrycaj d6eb8c36f5
Beacon sync align internal names and docu update (#2690)
* Rename `base` -> `coupler`, `B` -> `C`

why:
  Glossary: The jargon `base` is used for the `base state` block number
  which can be smaller than what is now the `coupler`.

* Rename `global state` -> `base`, `T` -> `B`

why:
  See glossary

* Rename `final` -> `end`, `F` -> `E`

why:
  See glossary. Previously, `final` denoted some finalised block but not
  `the finalised` block from the glossary (which is maximal.)

* Properly name finalised block as such, rename `Z` -> `F`

why:
  See glossary

* Rename `least` -> `dangling`, `L` -> `D`

* Metrics update (variables not covered yet)

* Docu update and corrections

* Logger updates

* Remove obsolete `skeleton*Key` kvt columns from `storage_types` module
2024-10-03 20:19:11 +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_final, "" &
"Block number of latest known finalised 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_final, ctx.lhc.final.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