Skip to content

Commit 2fc4a2a

Browse files
authored
Merge pull request #1073 from oasisprotocol/ptrus/fix/consensus-fetchtimer
analyzer/consensus: Record timing only for successful requests
2 parents eb7e247 + 219100e commit 2fc4a2a

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)