mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 05:17:22 +00:00
57 lines
2.3 KiB
Go
57 lines
2.3 KiB
Go
package blockchain
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
|
)
|
|
|
|
var (
|
|
beaconSlot = promauto.NewGauge(prometheus.GaugeOpts{
|
|
Name: "beacon_slot",
|
|
Help: "Latest slot of the beacon chain state",
|
|
})
|
|
beaconHeadSlot = promauto.NewGauge(prometheus.GaugeOpts{
|
|
Name: "beacon_head_slot",
|
|
Help: "Slot of the head block of the beacon chain",
|
|
})
|
|
beaconHeadRoot = promauto.NewGauge(prometheus.GaugeOpts{
|
|
Name: "beacon_head_root",
|
|
Help: "Root of the head block of the beacon chain, it returns the lowest 8 bytes interpreted as little endian",
|
|
})
|
|
competingAtts = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "competing_attestations",
|
|
Help: "The # of attestations received and processed from a competing chain",
|
|
})
|
|
competingBlks = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "competing_blocks",
|
|
Help: "The # of blocks received and processed from a competing chain",
|
|
})
|
|
processedBlkNoPubsub = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "processed_no_pubsub_block_counter",
|
|
Help: "The # of processed block without pubsub, this usually means the blocks from sync",
|
|
})
|
|
processedBlkNoPubsubForkchoice = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "processed_no_pubsub_forkchoice_block_counter",
|
|
Help: "The # of processed block without pubsub and forkchoice, this means indicate blocks from initial sync",
|
|
})
|
|
processedBlk = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "processed_block_counter",
|
|
Help: "The # of total processed in block chain service, with fork choice and pubsub",
|
|
})
|
|
processedAttNoPubsub = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "processed_no_pubsub_attestation_counter",
|
|
Help: "The # of processed attestation without pubsub, this usually means the attestations from sync",
|
|
})
|
|
processedAtt = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "processed_attestation_counter",
|
|
Help: "The # of processed attestation with pubsub and fork choice, this ususally means attestations from rpc",
|
|
})
|
|
)
|
|
|
|
func (c *ChainService) reportSlotMetrics(currentSlot uint64) {
|
|
beaconSlot.Set(float64(currentSlot))
|
|
beaconHeadSlot.Set(float64(c.HeadSlot()))
|
|
beaconHeadRoot.Set(float64(bytesutil.ToLowInt64(c.HeadRoot())))
|
|
}
|