Skip to content

Conversation

@DiogoSantoss
Copy link
Contributor

Track block and block_gossip event.
Fix event timestamp measurement.
Readjust head buckets.

category: feature
ticket: #3877

@DiogoSantoss DiogoSantoss self-assigned this Aug 29, 2025
@DiogoSantoss DiogoSantoss requested a review from Copilot August 29, 2025 10:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for tracking block and block_gossip events in the SSE (Server-Sent Events) listener to monitor beacon node performance. The changes fix event timestamp measurement and adjust head buckets for better metrics granularity.

  • Adds support for block and block_gossip SSE events with new data structures and handlers
  • Fixes timestamp measurement by capturing time when event type is parsed rather than when parsing begins
  • Adjusts histogram buckets for head delay metrics and adds new metrics for block events

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/sse/types.go Adds new event constants and data structures for block events, renames chainReorgData for consistency
app/sse/metrics.go Updates head delay buckets and adds new histogram metrics for block gossip and block events
app/sse/listener_internal_test.go Updates test expectations to match fixed delay calculation logic
app/sse/listener.go Implements handlers for new block events, refactors delay computation with configurable validation
app/sse/client.go Subscribes to new event topics and fixes timestamp capture timing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Name: "sse_head_delay",
Help: "Delay in seconds between slot start and head update, supplied by beacon node's SSE endpoint. Values between 8s and 12s for Ethereum mainnet are considered safe.",
Buckets: []float64{4, 6, 8, 10, 12, 16, 20},
Buckets: []float64{2, 4, 6, 8, 10, 12},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we make these buckets matching the sseBlock* buckets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made sseBlock* buckets more fine grained since we want to analyze where in the 4s window they fall but if head also requires this I'm open to change it

Buckets: []float64{1, 2, 4, 6, 8, 16},
}, []string{"addr"})

sseBlockGossipHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update TestMetricsReference

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
27.3% Duplication on New Code (required ≤ 15%)

See analysis details on SonarQube Cloud

@codecov
Copy link

codecov bot commented Aug 29, 2025

Codecov Report

❌ Patch coverage is 17.64706% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.06%. Comparing base (b300810) to head (ec3e5d0).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
app/sse/listener.go 12.50% 56 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3938      +/-   ##
==========================================
- Coverage   55.18%   55.06%   -0.13%     
==========================================
  Files         225      225              
  Lines       37173    37233      +60     
==========================================
- Hits        20514    20501      -13     
- Misses      14490    14567      +77     
+ Partials     2169     2165       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DiogoSantoss DiogoSantoss added the merge when ready Indicates bulldozer bot may merge when all checks pass label Sep 1, 2025
@obol-bulldozer obol-bulldozer bot merged commit 19c525c into main Sep 1, 2025
11 of 14 checks passed
@obol-bulldozer obol-bulldozer bot deleted the diogo/add-block-sse-event branch September 1, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge when ready Indicates bulldozer bot may merge when all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants