mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-27 19:37:08 +00:00
## What does this change do? This pull request completes the change to the `metricsgen` metrics. It adds `go generate` directives to all of the files containing the `Metrics` structs. Using the outputs of `metricsdiff` between these generated metrics and `master`, we can see that there is not a diff between the two sets of metrics when run locally. ``` [william@sidewinder] tendermint[wb/metrics-gen-transition]:. ◆ ./scripts/metricsgen/metricsdiff/metricsdiff metrics_master metrics_generated [william@sidewinder] tendermint[wb/metrics-gen-transition]:. ◆ ``` This change also adds parsing for a `metrics:` key in a field comment. If a comment line begins with `//metrics:` the rest of the line is interpreted to be the metric help text. Additionally, a bug where lists of labels were not properly quoted in the `metricsgen` rendered output was fixed.
26 lines
614 B
Go
26 lines
614 B
Go
package indexer
|
|
|
|
import (
|
|
"github.com/go-kit/kit/metrics"
|
|
)
|
|
|
|
//go:generate go run ../../../scripts/metricsgen -struct=Metrics
|
|
|
|
// MetricsSubsystem is a the subsystem label for the indexer package.
|
|
const MetricsSubsystem = "indexer"
|
|
|
|
// Metrics contains metrics exposed by this package.
|
|
type Metrics struct {
|
|
// Latency for indexing block events.
|
|
BlockEventsSeconds metrics.Histogram
|
|
|
|
// Latency for indexing transaction events.
|
|
TxEventsSeconds metrics.Histogram
|
|
|
|
// Number of complete blocks indexed.
|
|
BlocksIndexed metrics.Counter
|
|
|
|
// Number of transactions indexed.
|
|
TransactionsIndexed metrics.Counter
|
|
}
|