Browse Source

node: hook up eventlog and eventlog metrics (#7981)

pull/7985/head
M. J. Fromberger 3 years ago
committed by GitHub
parent
commit
a57567ba33
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      node/node.go

+ 17
- 0
node/node.go View File

@ -20,6 +20,7 @@ import (
"github.com/tendermint/tendermint/internal/blocksync"
"github.com/tendermint/tendermint/internal/consensus"
"github.com/tendermint/tendermint/internal/eventbus"
"github.com/tendermint/tendermint/internal/eventlog"
"github.com/tendermint/tendermint/internal/evidence"
"github.com/tendermint/tendermint/internal/mempool"
"github.com/tendermint/tendermint/internal/p2p"
@ -172,6 +173,19 @@ func makeNode(
return nil, combineCloseError(err, makeCloser(closers))
}
var eventLog *eventlog.Log
if w := cfg.RPC.EventLogWindowSize; w > 0 {
var err error
eventLog, err = eventlog.New(eventlog.LogSettings{
WindowSize: w,
MaxItems: cfg.RPC.EventLogMaxItems,
Metrics: nodeMetrics.eventlog,
})
if err != nil {
return nil, fmt.Errorf("initializing event log: %w", err)
}
}
indexerService, eventSinks, err := createAndStartIndexerService(
ctx, cfg, dbProvider, eventBus,
logger, genDoc.ChainID, nodeMetrics.indexer)
@ -396,6 +410,7 @@ func makeNode(
GenDoc: genDoc,
EventSinks: eventSinks,
EventBus: eventBus,
EventLog: eventLog,
Mempool: mp,
Logger: logger.With("module", "rpc"),
Config: *cfg.RPC,
@ -684,6 +699,7 @@ func defaultGenesisDocProviderFunc(cfg *config.Config) genesisDocProvider {
type nodeMetrics struct {
consensus *consensus.Metrics
eventlog *eventlog.Metrics
indexer *indexer.Metrics
mempool *mempool.Metrics
p2p *p2p.Metrics
@ -703,6 +719,7 @@ func defaultMetricsProvider(cfg *config.InstrumentationConfig) metricsProvider {
if cfg.Prometheus {
return &nodeMetrics{
consensus: consensus.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
eventlog: eventlog.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
indexer: indexer.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
mempool: mempool.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
p2p: p2p.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),


Loading…
Cancel
Save