add initial metric definition

This commit is contained in:
William Banfield
2022-02-17 13:54:11 -05:00
parent 28d34d635c
commit f7f9b6dbf5
+14
View File
@@ -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(),