mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 22:23:11 +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.
73 lines
2.7 KiB
Go
73 lines
2.7 KiB
Go
// Code generated by metricsgen. DO NOT EDIT.
|
|
|
|
package statesync
|
|
|
|
import (
|
|
"github.com/go-kit/kit/metrics/discard"
|
|
prometheus "github.com/go-kit/kit/metrics/prometheus"
|
|
stdprometheus "github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
|
|
labels := []string{}
|
|
for i := 0; i < len(labelsAndValues); i += 2 {
|
|
labels = append(labels, labelsAndValues[i])
|
|
}
|
|
return &Metrics{
|
|
TotalSnapshots: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
|
|
Namespace: namespace,
|
|
Subsystem: MetricsSubsystem,
|
|
Name: "total_snapshots",
|
|
Help: "The total number of snapshots discovered.",
|
|
}, labels).With(labelsAndValues...),
|
|
ChunkProcessAvgTime: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: MetricsSubsystem,
|
|
Name: "chunk_process_avg_time",
|
|
Help: "The average processing time per chunk.",
|
|
}, labels).With(labelsAndValues...),
|
|
SnapshotHeight: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: MetricsSubsystem,
|
|
Name: "snapshot_height",
|
|
Help: "The height of the current snapshot the has been processed.",
|
|
}, labels).With(labelsAndValues...),
|
|
SnapshotChunk: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
|
|
Namespace: namespace,
|
|
Subsystem: MetricsSubsystem,
|
|
Name: "snapshot_chunk",
|
|
Help: "The current number of chunks that have been processed.",
|
|
}, labels).With(labelsAndValues...),
|
|
SnapshotChunkTotal: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: MetricsSubsystem,
|
|
Name: "snapshot_chunk_total",
|
|
Help: "The total number of chunks in the current snapshot.",
|
|
}, labels).With(labelsAndValues...),
|
|
BackFilledBlocks: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
|
|
Namespace: namespace,
|
|
Subsystem: MetricsSubsystem,
|
|
Name: "back_filled_blocks",
|
|
Help: "The current number of blocks that have been back-filled.",
|
|
}, labels).With(labelsAndValues...),
|
|
BackFillBlocksTotal: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: MetricsSubsystem,
|
|
Name: "back_fill_blocks_total",
|
|
Help: "The total number of blocks that need to be back-filled.",
|
|
}, labels).With(labelsAndValues...),
|
|
}
|
|
}
|
|
|
|
func NopMetrics() *Metrics {
|
|
return &Metrics{
|
|
TotalSnapshots: discard.NewCounter(),
|
|
ChunkProcessAvgTime: discard.NewGauge(),
|
|
SnapshotHeight: discard.NewGauge(),
|
|
SnapshotChunk: discard.NewCounter(),
|
|
SnapshotChunkTotal: discard.NewGauge(),
|
|
BackFilledBlocks: discard.NewCounter(),
|
|
BackFillBlocksTotal: discard.NewGauge(),
|
|
}
|
|
}
|