2018-06-11 17:14:42 +04:00
|
|
|
package consensus
|
|
|
|
|
2018-06-16 11:12:55 +04:00
|
|
|
import (
|
|
|
|
"github.com/go-kit/kit/metrics"
|
|
|
|
"github.com/go-kit/kit/metrics/discard"
|
|
|
|
)
|
2018-06-11 17:14:42 +04:00
|
|
|
|
|
|
|
// Metrics contains metrics exposed by this package.
|
|
|
|
type Metrics struct {
|
2018-06-19 11:27:58 +04:00
|
|
|
// Height of the chain.
|
2018-06-15 15:10:25 +04:00
|
|
|
Height metrics.Gauge
|
|
|
|
|
2018-06-19 11:27:58 +04:00
|
|
|
// Number of rounds.
|
2018-06-15 14:45:21 +04:00
|
|
|
Rounds metrics.Gauge
|
2018-06-15 14:35:36 +04:00
|
|
|
|
2018-06-19 11:27:58 +04:00
|
|
|
// Number of validators.
|
|
|
|
Validators metrics.Gauge
|
|
|
|
// Total power of all validators.
|
|
|
|
ValidatorsPower metrics.Gauge
|
|
|
|
// Number of validators who did not sign.
|
|
|
|
MissingValidators metrics.Gauge
|
|
|
|
// Total power of the missing validators.
|
|
|
|
MissingValidatorsPower metrics.Gauge
|
|
|
|
// Number of validators who tried to double sign.
|
|
|
|
ByzantineValidators metrics.Gauge
|
|
|
|
// Total power of the byzantine validators.
|
2018-06-15 14:35:36 +04:00
|
|
|
ByzantineValidatorsPower metrics.Gauge
|
|
|
|
|
2018-06-19 11:27:58 +04:00
|
|
|
// Time between this and the last block.
|
2018-06-15 14:23:34 +04:00
|
|
|
BlockIntervalSeconds metrics.Histogram
|
2018-06-15 14:35:36 +04:00
|
|
|
|
2018-06-19 11:27:58 +04:00
|
|
|
// Number of transactions.
|
|
|
|
NumTxs metrics.Gauge
|
|
|
|
// Size of the block.
|
2018-06-14 16:09:32 +04:00
|
|
|
BlockSizeBytes metrics.Gauge
|
2018-06-19 11:27:58 +04:00
|
|
|
// Total number of transactions.
|
|
|
|
TotalTxs metrics.Gauge
|
2018-06-11 17:14:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// NopMetrics returns no-op Metrics.
|
|
|
|
func NopMetrics() *Metrics {
|
|
|
|
return &Metrics{
|
2018-06-15 15:10:25 +04:00
|
|
|
Height: discard.NewGauge(),
|
|
|
|
|
|
|
|
Rounds: discard.NewGauge(),
|
|
|
|
|
|
|
|
Validators: discard.NewGauge(),
|
|
|
|
ValidatorsPower: discard.NewGauge(),
|
|
|
|
MissingValidators: discard.NewGauge(),
|
|
|
|
MissingValidatorsPower: discard.NewGauge(),
|
|
|
|
ByzantineValidators: discard.NewGauge(),
|
|
|
|
ByzantineValidatorsPower: discard.NewGauge(),
|
|
|
|
|
2018-06-15 14:23:34 +04:00
|
|
|
BlockIntervalSeconds: discard.NewHistogram(),
|
2018-06-15 15:10:25 +04:00
|
|
|
|
|
|
|
NumTxs: discard.NewGauge(),
|
|
|
|
BlockSizeBytes: discard.NewGauge(),
|
|
|
|
TotalTxs: discard.NewGauge(),
|
2018-06-11 17:14:42 +04:00
|
|
|
}
|
|
|
|
}
|