Skip to content

Commit 219100e

Browse files
committed
analyzer/consensus: Record timing only for successful requests
This makes it consistent with other (runtime) block analyzers.
1 parent eb7e247 commit 219100e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.changelog/1073.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
analyzer/consensus: Record timing only for successful requests

analyzer/consensus/consensus.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,11 @@ func (m *processor) ProcessBlock(ctx context.Context, uheight uint64) error {
348348
// Fetch all data.
349349
fetchTimer := m.metrics.BlockFetchLatencies()
350350
data, err := fetchAllData(ctx, m.source, m.network, height, m.mode == analyzer.FastSyncMode)
351-
fetchTimer.ObserveDuration()
352351
if err != nil {
353352
return err
354353
}
354+
// We make no observation in case of a data fetch error; those timings are misleading.
355+
fetchTimer.ObserveDuration()
355356

356357
// Process data, prepare updates.
357358
analysisTimer := m.metrics.BlockAnalysisLatencies()

analyzer/runtime/runtime.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ func (m *processor) ProcessBlock(ctx context.Context, round uint64) error {
256256
if err != nil {
257257
return err
258258
}
259-
260-
fetchTimer.ObserveDuration() // We make no observation in case of a data fetch error; those timings are misleading.
259+
// We make no observation in case of a data fetch error; those timings are misleading.
260+
fetchTimer.ObserveDuration()
261261

262262
// Preprocess data.
263263
analysisTimer := m.metrics.BlockAnalysisLatencies()

0 commit comments

Comments
 (0)