mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-16 12:16:11 +00:00
add metrics to dbStore
This commit is contained in:
+12
-3
@@ -34,13 +34,22 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
|
||||
Name: "validator_set_updates",
|
||||
Help: "ValidatorSetUpdates is the total number of times the application has udated the validator set since process start.",
|
||||
}, labels).With(labelsAndValues...),
|
||||
StoreAccessDurationSeconds: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: MetricsSubsystem,
|
||||
Name: "store_access_duration_seconds",
|
||||
Help: "The duration of accesses to the state store labeled by which method was called on the store.",
|
||||
|
||||
Buckets: stdprometheus.ExponentialBuckets(0.01, 2, 5),
|
||||
}, append(labels, "method")).With(labelsAndValues...),
|
||||
}
|
||||
}
|
||||
|
||||
func NopMetrics() *Metrics {
|
||||
return &Metrics{
|
||||
BlockProcessingTime: discard.NewHistogram(),
|
||||
ConsensusParamUpdates: discard.NewCounter(),
|
||||
ValidatorSetUpdates: discard.NewCounter(),
|
||||
BlockProcessingTime: discard.NewHistogram(),
|
||||
ConsensusParamUpdates: discard.NewCounter(),
|
||||
ValidatorSetUpdates: discard.NewCounter(),
|
||||
StoreAccessDurationSeconds: discard.NewHistogram(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,8 @@ type Metrics struct {
|
||||
// ValidatorSetUpdates is the total number of times the application has
|
||||
// udated the validator set since process start.
|
||||
ValidatorSetUpdates metrics.Counter
|
||||
|
||||
// The duration of accesses to the state store labeled by which method
|
||||
// was called on the store.
|
||||
StoreAccessDurationSeconds metrics.Histogram `metrics_buckettype:"exp" metrics_bucketsizes:"0.01, 2, 5" metrics_labels:"method"`
|
||||
}
|
||||
|
||||
+6
-1
@@ -80,6 +80,8 @@ type Store interface {
|
||||
type dbStore struct {
|
||||
db dbm.DB
|
||||
|
||||
metrics *Metrics
|
||||
|
||||
StoreOptions
|
||||
}
|
||||
|
||||
@@ -95,7 +97,10 @@ var _ Store = (*dbStore)(nil)
|
||||
|
||||
// NewStore creates the dbStore of the state pkg.
|
||||
func NewStore(db dbm.DB, options StoreOptions) Store {
|
||||
return dbStore{db, options}
|
||||
return dbStore{
|
||||
db: db,
|
||||
StoreOptions: options,
|
||||
}
|
||||
}
|
||||
|
||||
// LoadStateFromDBOrGenesisFile loads the most recent state from the database,
|
||||
|
||||
Reference in New Issue
Block a user