Conversation
|
|
This PR is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
|
This PR was closed because it has been stalled for 35 days with no activity. |
|
@claude - review this PR |
|
Claude finished @pratikspatil024's task in 2m 4s —— View job PR Review: Sync Metrics
SummaryThis PR adds metrics to compare stateful and stateless sync speed. The changes introduce per-item download duration tracking for headers, bodies, receipts, and witnesses, as well as a new metric to track intervals between consecutive NewBlock pushes. Changes Overview
Detailed Review1. Code Quality: Good ✅The implementation follows consistent patterns and the code is well-structured:
2. Issues Found2.1. Code Duplication (SonarCloud flagged) The PR has two nearly identical helper functions for recording per-item durations:
These have the same logic pattern. While the first two operate in different contexts (one uses a global timer directly, one dispatches via type switch, and one takes a timer parameter), there's still duplication detected by SonarCloud at 8.2% (threshold is 3%). Recommendation: Consider consolidating by making 2.2. Debug Log Left in Code In log.Error("handleNewBlock", "ReceivedAt", ann.Block.ReceivedAt.Unix())This uses 2.3. Metrics Placement The new metrics in Similarly, the metrics in 3. Metrics Overview
4. Thread Safety ✅The use of 5. Performance Impact: Minimal ✅The metric recording is performed inline with minimal overhead:
Recommendations
VerdictThe PR adds valuable metrics for comparing sync performance. The implementation is sound and follows existing patterns. The main concern is the code duplication flagged by SonarCloud which prevents the quality gate from passing. Suggested action: Address the duplication issue to pass the quality gate, then this PR should be ready to merge. | |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (63.82%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #1928 +/- ##
===========================================
+ Coverage 50.59% 50.89% +0.29%
===========================================
Files 875 878 +3
Lines 151820 152469 +649
===========================================
+ Hits 76815 77599 +784
+ Misses 69929 69781 -148
- Partials 5076 5089 +13
... and 22 files with indirect coverage changes
🚀 New features to boost your workflow:
|
71d6238 to
d57b79f
Compare
|
|
@claude - re-review this PR. |
|
Claude finished @pratikspatil024's task in 1m 7s —— View job PR Re-Review: Sync Metrics
SummaryThis PR adds comprehensive metrics for comparing stateful and stateless sync performance. The author has addressed the previous review feedback by creating a shared utility function and adding unit tests. Changes Since Last ReviewThe author implemented the recommended refactoring:
Detailed Review1.
|
* Added metrics for items download * Added metrics for headers * Added debug logging * Added logging for timestamps * Added push block interval metric * Remove logs * minor refactoring, reduced code duplication, made metrics name consistent * added unit test for helper function --------- Co-authored-by: Pratik Patil <pratikspatil024@gmail.com> (cherry picked from commit 46e2631)


Description
Added more metrics to compare stateful and stateless sync speed.
Summary
metrics.RecordPerItemDuration— a shared helper in themetricspackagethat amortizes a batch download duration across individual items and records the
per-item latency on a timer.
item_download_duration) for headers,bodies, receipts, and witnesses in both the downloader (concurrent and
Bor-specific fetchers) and the announcement-driven block fetcher.
NewBlockpush interval timer (eth/protocols/eth/newblock/push_interval)that tracks time deltas between consecutive inbound
NewBlockmessages,providing visibility into block propagation cadence.
bor_fetchers.go,add nil-safety checks on header/body response pointers in
block_fetcher.go.New Metrics
eth/downloader/headers/item_download_durationeth/downloader/bodies/item_download_durationeth/downloader/receipts/item_download_durationeth/downloader/witnesses/item_download_durationeth/fetcher/block/headers/item_download_durationeth/fetcher/block/bodies/item_download_durationeth/fetcher/block/witnesses/item_download_durationeth/protocols/eth/newblock/push_interval