mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-09 21:40:11 +00:00
Merge branch 'master' into wb/add-consensus-param-internal
This commit is contained in:
72
internal/statesync/metrics.gen.go
Normal file
72
internal/statesync/metrics.gen.go
Normal file
@@ -0,0 +1,72 @@
|
||||
// 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(),
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,6 @@ package statesync
|
||||
|
||||
import (
|
||||
"github.com/go-kit/kit/metrics"
|
||||
"github.com/go-kit/kit/metrics/discard"
|
||||
"github.com/go-kit/kit/metrics/prometheus"
|
||||
stdprometheus "github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -12,80 +9,22 @@ const (
|
||||
MetricsSubsystem = "statesync"
|
||||
)
|
||||
|
||||
//go:generate go run ../../scripts/metricsgen -struct=Metrics
|
||||
|
||||
// Metrics contains metrics exposed by this package.
|
||||
type Metrics struct {
|
||||
TotalSnapshots metrics.Counter
|
||||
// The total number of snapshots discovered.
|
||||
TotalSnapshots metrics.Counter
|
||||
// The average processing time per chunk.
|
||||
ChunkProcessAvgTime metrics.Gauge
|
||||
SnapshotHeight metrics.Gauge
|
||||
SnapshotChunk metrics.Counter
|
||||
SnapshotChunkTotal metrics.Gauge
|
||||
BackFilledBlocks metrics.Counter
|
||||
// The height of the current snapshot the has been processed.
|
||||
SnapshotHeight metrics.Gauge
|
||||
// The current number of chunks that have been processed.
|
||||
SnapshotChunk metrics.Counter
|
||||
// The total number of chunks in the current snapshot.
|
||||
SnapshotChunkTotal metrics.Gauge
|
||||
// The current number of blocks that have been back-filled.
|
||||
BackFilledBlocks metrics.Counter
|
||||
// The total number of blocks that need to be back-filled.
|
||||
BackFillBlocksTotal metrics.Gauge
|
||||
}
|
||||
|
||||
// PrometheusMetrics returns Metrics build using Prometheus client library.
|
||||
// Optionally, labels can be provided along with their values ("foo",
|
||||
// "fooValue").
|
||||
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_chunks_total",
|
||||
Help: "The total number of chunks in the current snapshot.",
|
||||
}, labels).With(labelsAndValues...),
|
||||
BackFilledBlocks: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: MetricsSubsystem,
|
||||
Name: "backfilled_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: "backfilled_blocks_total",
|
||||
Help: "The total number of blocks that need to be back-filled.",
|
||||
}, labels).With(labelsAndValues...),
|
||||
}
|
||||
}
|
||||
|
||||
// NopMetrics returns no-op Metrics.
|
||||
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(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
context "context"
|
||||
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
state "github.com/tendermint/tendermint/internal/state"
|
||||
|
||||
testing "testing"
|
||||
|
||||
Reference in New Issue
Block a user