Report DB metrics #140
@ -22,6 +22,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
@ -151,6 +152,7 @@ func NewBlockCache(max uint) blockCache {
|
|||||||
func New(stack *node.Node, ethServ *eth.Ethereum, cfg *ethconfig.Config, params ServiceParams) error {
|
func New(stack *node.Node, ethServ *eth.Ethereum, cfg *ethconfig.Config, params ServiceParams) error {
|
||||||
blockChain := ethServ.BlockChain()
|
blockChain := ethServ.BlockChain()
|
||||||
var indexer ind.Indexer
|
var indexer ind.Indexer
|
||||||
|
quitCh := make(chan bool)
|
||||||
if params.DBParams != nil {
|
if params.DBParams != nil {
|
||||||
info := nodeinfo.Info{
|
info := nodeinfo.Info{
|
||||||
GenesisBlock: blockChain.Genesis().Hash().Hex(),
|
GenesisBlock: blockChain.Genesis().Hash().Hex(),
|
||||||
@ -169,6 +171,8 @@ func New(stack *node.Node, ethServ *eth.Ethereum, cfg *ethconfig.Config, params
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
indexer.ReportDBMetrics(10*time.Second, quitCh)
|
||||||
}
|
}
|
||||||
workers := params.NumWorkers
|
workers := params.NumWorkers
|
||||||
if workers == 0 {
|
if workers == 0 {
|
||||||
@ -178,7 +182,7 @@ func New(stack *node.Node, ethServ *eth.Ethereum, cfg *ethconfig.Config, params
|
|||||||
Mutex: sync.Mutex{},
|
Mutex: sync.Mutex{},
|
||||||
BlockChain: blockChain,
|
BlockChain: blockChain,
|
||||||
Builder: NewBuilder(blockChain.StateCache()),
|
Builder: NewBuilder(blockChain.StateCache()),
|
||||||
QuitChan: make(chan bool),
|
QuitChan: quitCh,
|
||||||
Subscriptions: make(map[common.Hash]map[rpc.ID]Subscription),
|
Subscriptions: make(map[common.Hash]map[rpc.ID]Subscription),
|
||||||
SubscriptionTypes: make(map[common.Hash]Params),
|
SubscriptionTypes: make(map[common.Hash]Params),
|
||||||
BlockCache: NewBlockCache(workers),
|
BlockCache: NewBlockCache(workers),
|
||||||
|
Loading…
Reference in New Issue
Block a user