Skip to content

Commit be53e37

Browse files
authored
Merge pull request #8004 from onflow/peter/execdata-metrics-highest-consecutive
[Access] Record the highest consecutive download height
2 parents 0ff8354 + 92695b5 commit be53e37

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

module/metrics.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ type ExecutionDataRequesterMetrics interface {
801801
ExecutionDataFetchStarted()
802802

803803
// ExecutionDataFetchFinished records a completed download
804+
// Pass the highest consecutive height to ensure the metrics reflect the height up to which the
805+
// requester has completed downloads. This allows us to easily see when downloading gets stuck.
804806
ExecutionDataFetchFinished(duration time.Duration, success bool, height uint64)
805807

806808
// NotificationSent reports that ExecutionData received notifications were sent for a block height

module/metrics/execution_data_requester.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,14 @@ func NewExecutionDataRequesterCollector() module.ExecutionDataRequesterMetrics {
8585
}
8686
}
8787

88+
// ExecutionDataFetchStarted records an in-progress download
8889
func (ec *ExecutionDataRequesterCollector) ExecutionDataFetchStarted() {
8990
ec.downloadsInProgress.Inc()
9091
}
9192

93+
// ExecutionDataFetchFinished records a completed download
94+
// Pass the highest consecutive height to ensure the metrics reflect the height up to which the
95+
// requester has completed downloads. This allows us to easily see when downloading gets stuck.
9296
func (ec *ExecutionDataRequesterCollector) ExecutionDataFetchFinished(duration time.Duration, success bool, height uint64) {
9397
ec.downloadsInProgress.Dec()
9498
ec.fetchDuration.Observe(float64(duration.Milliseconds()))
@@ -100,11 +104,13 @@ func (ec *ExecutionDataRequesterCollector) ExecutionDataFetchFinished(duration t
100104
}
101105
}
102106

107+
// NotificationSent records that ExecutionData received notifications were sent for a block height
103108
func (ec *ExecutionDataRequesterCollector) NotificationSent(height uint64) {
104109
ec.outstandingNotifications.Dec()
105110
ec.highestNotificationHeight.Set(float64(height))
106111
}
107112

113+
// FetchRetried records that a download retry was processed
108114
func (ec *ExecutionDataRequesterCollector) FetchRetried() {
109115
ec.downloadRetries.Inc()
110116
}

module/state_synchronization/requester/execution_data_requester.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,9 @@ func (e *executionDataRequester) processFetchRequest(parentCtx irrecoverable.Sig
382382

383383
execData, err := e.execDataCache.ByBlockID(ctx, blockID)
384384

385-
e.metrics.ExecutionDataFetchFinished(time.Since(start), err == nil, height)
385+
// use the last processed index to ensure the metrics reflect the highest _consecutive_ height.
386+
// this makes it easier to see when downloading gets stuck at a height.
387+
e.metrics.ExecutionDataFetchFinished(time.Since(start), err == nil, e.blockConsumer.LastProcessedIndex())
386388

387389
if isInvalidBlobError(err) {
388390
// This means an execution result was sealed with an invalid execution data id (invalid data).

0 commit comments

Comments
 (0)