mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
* Add additional metrics to p2p and consensus Partially addresses https://github.com/cosmos/cosmos-sdk/issues/2169. * WIP * Updates from code review * Updates from code review * Add instrumentation namespace to configuration * Fix test failure * Updates from code review * Add quotes * Add atomic load * Use storeint64 * Use addInt64 in writePacketMsgTo
35 lines
877 B
Go
35 lines
877 B
Go
package mempool
|
|
|
|
import (
|
|
"github.com/go-kit/kit/metrics"
|
|
"github.com/go-kit/kit/metrics/discard"
|
|
prometheus "github.com/go-kit/kit/metrics/prometheus"
|
|
stdprometheus "github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
// Metrics contains metrics exposed by this package.
|
|
// see MetricsProvider for descriptions.
|
|
type Metrics struct {
|
|
// Size of the mempool.
|
|
Size metrics.Gauge
|
|
}
|
|
|
|
// PrometheusMetrics returns Metrics build using Prometheus client library.
|
|
func PrometheusMetrics(namespace string) *Metrics {
|
|
return &Metrics{
|
|
Size: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: "mempool",
|
|
Name: "size",
|
|
Help: "Size of the mempool (number of uncommitted transactions).",
|
|
}, []string{}),
|
|
}
|
|
}
|
|
|
|
// NopMetrics returns no-op Metrics.
|
|
func NopMetrics() *Metrics {
|
|
return &Metrics{
|
|
Size: discard.NewGauge(),
|
|
}
|
|
}
|