mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-10 05:50:19 +00:00
Merge remote-tracking branch 'origin/wb/abci-metrics' into wb/abci-metrics
This commit is contained in:
@@ -61,6 +61,9 @@ type Metrics struct {
|
||||
|
||||
// Number of blockparts transmitted by peer.
|
||||
BlockParts metrics.Counter
|
||||
|
||||
// Histogram of time taken per step annotated with reason that the step proceeded.
|
||||
StepTime metrics.Histogram
|
||||
}
|
||||
|
||||
// PrometheusMetrics returns Metrics build using Prometheus client library.
|
||||
@@ -187,6 +190,12 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
|
||||
Name: "block_parts",
|
||||
Help: "Number of blockparts transmitted by peer.",
|
||||
}, append(labels, "peer_id")).With(labelsAndValues...),
|
||||
StepTime: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: MetricsSubsystem,
|
||||
Name: "step_time",
|
||||
Help: "Time spent per step.",
|
||||
}, append(labels, "step", "reason")).With(labelsAndValues...),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ func (app *appConnConsensus) DeliverTxAsync(
|
||||
ctx context.Context,
|
||||
req types.RequestDeliverTx,
|
||||
) (*abciclient.ReqRes, error) {
|
||||
defer addTimeSample(app.metrics.MethodTiming.With("method", "deliver_tx", "type", "aync"))()
|
||||
defer addTimeSample(app.metrics.MethodTiming.With("method", "deliver_tx", "type", "async"))()
|
||||
return app.appConn.DeliverTxAsync(ctx, req)
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ func (app *appConnMempool) Error() error {
|
||||
}
|
||||
|
||||
func (app *appConnMempool) FlushAsync(ctx context.Context) (*abciclient.ReqRes, error) {
|
||||
defer addTimeSample(app.metrics.MethodTiming.With("method", "flush", "type", "sync"))()
|
||||
defer addTimeSample(app.metrics.MethodTiming.With("method", "flush", "type", "async"))()
|
||||
return app.appConn.FlushAsync(ctx)
|
||||
}
|
||||
|
||||
@@ -148,9 +148,7 @@ func (app *appConnMempool) FlushSync(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (app *appConnMempool) CheckTxAsync(ctx context.Context, req types.RequestCheckTx) (*abciclient.ReqRes, error) {
|
||||
start := time.Now()
|
||||
defer app.metrics.MethodTiming.With("method", "check_tx",
|
||||
"type", "sync").Observe(time.Since(start).Seconds())
|
||||
defer addTimeSample(app.metrics.MethodTiming.With("method", "check_tx", "type", "async"))()
|
||||
return app.appConn.CheckTxAsync(ctx, req)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user