mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 06:15:33 +00:00
Absence of this label causes a panic because the setters try to access the label despite it never being added to the metric. This PR adds the label to the metrics, thus preventing the panic.
#### PR checklist
- [ ] Tests written/updated, or no tests needed
- [ ] `CHANGELOG_PENDING.md` updated, or no changelog entry needed
- [ ] Updated relevant documentation (`docs/`) and code comments, or no
documentation updates needed
28 lines
799 B
Go
28 lines
799 B
Go
package p2p
|
|
|
|
import (
|
|
"github.com/go-kit/kit/metrics"
|
|
)
|
|
|
|
const (
|
|
// MetricsSubsystem is a subsystem shared by all metrics exposed by this
|
|
// package.
|
|
MetricsSubsystem = "p2p"
|
|
)
|
|
|
|
//go:generate go run ../scripts/metricsgen -struct=Metrics
|
|
|
|
// Metrics contains metrics exposed by this package.
|
|
type Metrics struct {
|
|
// Number of peers.
|
|
Peers metrics.Gauge
|
|
// Number of bytes received from a given peer.
|
|
PeerReceiveBytesTotal metrics.Counter `metrics_labels:"peer_id,chID"`
|
|
// Number of bytes sent to a given peer.
|
|
PeerSendBytesTotal metrics.Counter `metrics_labels:"peer_id,chID"`
|
|
// Pending bytes to be sent to a given peer.
|
|
PeerPendingSendBytes metrics.Gauge `metrics_labels:"peer_id"`
|
|
// Number of transactions submitted by each peer.
|
|
NumTxs metrics.Gauge `metrics_labels:"peer_id"`
|
|
}
|