From f7f9b6dbf539f9e5f10f73255c125adc18810882 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Thu, 17 Feb 2022 13:54:11 -0500 Subject: [PATCH] add initial metric definition --- internal/consensus/metrics.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/internal/consensus/metrics.go b/internal/consensus/metrics.go index 7526518dc..2cdf9e275 100644 --- a/internal/consensus/metrics.go +++ b/internal/consensus/metrics.go @@ -66,6 +66,10 @@ type Metrics struct { // Histogram of time taken per step annotated with reason that the step proceeded. StepTime metrics.Histogram + // Histogram of time taken to receive a block, measured between receiving the first piece of the + // the block and receiving the final piece of the block. + BlockGossipReceiveTime metrics.Histogram + // QuroumPrevoteMessageDelay is the interval in seconds between the proposal // timestamp and the timestamp of the earliest prevote that achieved a quorum // during the prevote step. @@ -212,6 +216,15 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics { Name: "block_parts", Help: "Number of blockparts transmitted by peer.", }, append(labels, "peer_id")).With(labelsAndValues...), + BlockGossipReceiveTime: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "block_gossip_receive_time", + Help: "Difference in seconds between when the validator receives the" + + "first piece of a block and when the validator receives the last" + + " piece of a block.", + Buckets: stdprometheus.ExponentialBucketsRange(0, 100, 8), + }, labels).With(labelsAndValues...), StepTime: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{ Namespace: namespace, Subsystem: MetricsSubsystem, @@ -271,6 +284,7 @@ func NopMetrics() *Metrics { BlockSyncing: discard.NewGauge(), StateSyncing: discard.NewGauge(), BlockParts: discard.NewCounter(), + BlockGossipReceiveTime: discard.NewHistogram(), QuorumPrevoteMessageDelay: discard.NewGauge(), FullPrevoteMessageDelay: discard.NewGauge(), ProposalTimestampDifference: discard.NewHistogram(),