monitoring: add prometheus monitoring
add init metrics service which uses prometheus; add configuration for metrics service; add monitoring metrics for blockchain,rpc,server;
This commit is contained in:
parent
0ea7568caa
commit
d374175170
22 changed files with 468 additions and 22 deletions
|
@ -34,6 +34,7 @@ func (bq *blockQueue) run() {
|
|||
minblock := item.(*core.Block)
|
||||
if minblock.Index <= bq.chain.BlockHeight()+1 {
|
||||
_, _ = bq.queue.Get(1)
|
||||
updateBlockQueueLenMetric(bq.length())
|
||||
if minblock.Index == bq.chain.BlockHeight()+1 {
|
||||
err := bq.chain.AddBlock(minblock)
|
||||
if err != nil {
|
||||
|
@ -58,6 +59,8 @@ func (bq *blockQueue) putBlock(block *core.Block) error {
|
|||
return nil
|
||||
}
|
||||
err := bq.queue.Put(block)
|
||||
// update metrics
|
||||
updateBlockQueueLenMetric(bq.length())
|
||||
select {
|
||||
case bq.checkBlocks <- struct{}{}:
|
||||
// ok, signalled to goroutine processing queue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue