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:
Vsevolod Brekelov 2019-10-29 20:51:17 +03:00
parent 0ea7568caa
commit d374175170
22 changed files with 468 additions and 22 deletions

View file

@ -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