mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 14:21:14 +00:00
Add basic metrics to the indexer package. (#7250)
This follows the same model as we did in the p2p package. Rework the indexer service constructor to take a struct of arguments, that makes it easier to construct the optional settings. Deprecate but do not remove the existing constructor. Clean up node initialization a little bit.
This commit is contained in:
34
node/node.go
34
node/node.go
@@ -171,7 +171,8 @@ func makeNode(cfg *config.Config,
|
||||
return nil, combineCloseError(err, makeCloser(closers))
|
||||
}
|
||||
|
||||
indexerService, eventSinks, err := createAndStartIndexerService(cfg, dbProvider, eventBus, logger, genDoc.ChainID)
|
||||
indexerService, eventSinks, err := createAndStartIndexerService(cfg, dbProvider, eventBus,
|
||||
logger, genDoc.ChainID, nodeMetrics.indexer)
|
||||
if err != nil {
|
||||
return nil, combineCloseError(err, makeCloser(closers))
|
||||
}
|
||||
@@ -900,11 +901,12 @@ func defaultGenesisDocProviderFunc(cfg *config.Config) genesisDocProvider {
|
||||
|
||||
type nodeMetrics struct {
|
||||
consensus *consensus.Metrics
|
||||
p2p *p2p.Metrics
|
||||
indexer *indexer.Metrics
|
||||
mempool *mempool.Metrics
|
||||
p2p *p2p.Metrics
|
||||
proxy *proxy.Metrics
|
||||
state *sm.Metrics
|
||||
statesync *statesync.Metrics
|
||||
proxy *proxy.Metrics
|
||||
}
|
||||
|
||||
// metricsProvider returns consensus, p2p, mempool, state, statesync Metrics.
|
||||
@@ -916,21 +918,23 @@ func defaultMetricsProvider(cfg *config.InstrumentationConfig) metricsProvider {
|
||||
return func(chainID string) *nodeMetrics {
|
||||
if cfg.Prometheus {
|
||||
return &nodeMetrics{
|
||||
consensus.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
p2p.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
mempool.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
sm.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
statesync.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
proxy.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
consensus: consensus.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),
|
||||
proxy: proxy.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
state: sm.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
statesync: statesync.PrometheusMetrics(cfg.Namespace, "chain_id", chainID),
|
||||
}
|
||||
}
|
||||
return &nodeMetrics{
|
||||
consensus.NopMetrics(),
|
||||
p2p.NopMetrics(),
|
||||
mempool.NopMetrics(),
|
||||
sm.NopMetrics(),
|
||||
statesync.NopMetrics(),
|
||||
proxy.NopMetrics(),
|
||||
consensus: consensus.NopMetrics(),
|
||||
indexer: indexer.NopMetrics(),
|
||||
mempool: mempool.NopMetrics(),
|
||||
p2p: p2p.NopMetrics(),
|
||||
proxy: proxy.NopMetrics(),
|
||||
state: sm.NopMetrics(),
|
||||
statesync: statesync.NopMetrics(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user