Skip to content

Conversation

@julienrbrt
Copy link
Member

Overview

Proper count of pending blobs metrics.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedFeb 1, 2026, 7:49 PM

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @julienrbrt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the mechanism for tracking and reporting pending blobs metrics. It centralizes the calculation and update of the DASubmitterPendingBlobs metric within the main submission loop, ensuring a more consistent and accurate representation of the current backlog. This change removes redundant metric update calls from the submitToDA helper function and cleans up associated test code.

Highlights

  • Metric Refactoring: The logic for updating the DASubmitterPendingBlobs metric has been moved out of the submitToDA helper function, removing the getTotalPendingFn parameter and its associated calls.
  • Centralized Metric Update: The DASubmitterPendingBlobs metric is now updated centrally within the daSubmissionLoop in submitter.go, calculating the sum of pending headers and data blobs once per ticker cycle.
  • Code Cleanup: Unused mock code related to the Sync method in test/mocks/store.go has been removed, and test calls to submitToDA were updated to match the new function signature.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@claude
Copy link
Contributor

claude bot commented Jan 30, 2026

Claude finished @julienrbrt's task in 2m 34s —— View job


Code Review Complete

I've reviewed the pending blobs metrics refactoring. This is a solid fix that corrects a significant bug in the metric counting logic while also simplifying the codebase.


Summary

Problem Fixed: The previous implementation had a critical flaw where DASubmitterPendingBlobs would be set to either the pending headers count OR the pending data count (whichever was submitted last), rather than their sum. This led to inaccurate metrics that didn't reflect the true backlog.

Solution: The metric update logic was moved from the submitToDA helper function to the centralized daSubmissionLoop in submitter.go:311, where it's calculated once per ticker cycle as headersNb + dataNb.

Impact:

  • Removes 89 lines of code (mostly unused mock code)
  • Adds 7 lines (the centralized metric update)
  • Net improvement in code clarity and correctness

Code Quality & Architecture ✅

Strengths:

  1. Correct Fix: The centralized calculation at submitter.go:311 properly sums both pending headers and data counts, fixing the original bug where only one would be reported.

  2. Simplified Design: Removing the getTotalPendingFn parameter from submitToDA reduces coupling between the generic submission helper and the specific cache implementation.

  3. Better Placement: The metric update now happens in the same loop that checks headersNb and dataNb, ensuring consistency and reducing duplicate cache queries.

  4. Idiomatic Go: The code follows Go conventions well, with clear variable names and appropriate use of atomic operations for concurrent access.

Observations:

  1. The metric is now updated on every ticker cycle (every checkInterval = max(blockTime/4, 100ms)) rather than on each submission attempt. This is actually better for observability as it provides regular updates even when no submissions are happening.

  2. The removal of metric updates from the submitToDA retry loop eliminates redundant updates during retries, backoffs, and partial successes.


Error Handling & Resilience ✅

No changes to error handling in this PR. The existing error handling patterns remain sound:

  • Proper error wrapping with context
  • Critical error detection for oversized items
  • Appropriate use of retry logic with backoff

Security ✅

No security implications from this change. The refactoring is purely internal to metrics reporting.


Performance & Resource Efficiency ✅

Performance Improvements:

  1. Reduced Cache Calls: Previously, getTotalPendingFn() was called multiple times during the submission retry loop (at start, on success, on partial success, on too-big errors). Now it's called once per ticker cycle.

  2. Simpler Call Stack: Removing the function parameter reduces stack overhead and makes the code easier to inline.

Minor Consideration:
The metric update at submitter.go:311 happens on every ticker regardless of whether headersNb or dataNb is non-zero. This is fine since it's just two atomic loads and one gauge set, but it could theoretically be moved inside the if headersNb > 0 || dataNb > 0 block if micro-optimization is desired. However, I'd argue the current approach is cleaner—it ensures the metric is always up-to-date even when there are zero pending items.


Testing & Reliability ✅

Test Updates:
The test changes in da_submitter_mocks_test.go correctly remove the getTotalPendingFn parameter from all test calls to submitToDA. The tests remain comprehensive and cover:

  • Mempool retry scenarios
  • Unknown error retries
  • Too-big batch halving
  • Sentinel gas price preservation
  • Partial success handling

Test Coverage: According to Codecov, all modified lines are covered by tests, and overall coverage remains stable at 55.33%.

Suggestions:
Consider adding a specific test case that verifies the DASubmitterPendingBlobs metric is updated correctly in the submission loop. Currently, the tests use common.NopMetrics(), so the metric behavior isn't being validated. A test like this would strengthen confidence:

func TestDASubmissionLoop_UpdatesPendingBlobsMetric(t *testing.T) {
    // Test that the metric correctly sums headers + data pending counts
    // and updates on each ticker cycle
}

Documentation & Developer Experience ✅

CHANGELOG.md: Properly documented with link to PR.

Code Comments: The existing comments remain clear. The comment at submitter.go:310 explains the metric update:

// Update metrics with current pending counts
s.metrics.DASubmitterPendingBlobs.Set(float64(headersNb + dataNb))

Minor Enhancement: Consider updating the comment to be more explicit about why this is the correct place:

// Update metrics with current pending counts (sum of headers + data)
// This is calculated here to ensure accurate total backlog reporting
s.metrics.DASubmitterPendingBlobs.Set(float64(headersNb + dataNb))

Gemini's Suggestion - Granular Metrics 💡

Gemini Code Assist suggested adding separate metrics for PendingHeadersCount and PendingDataCount:

s.metrics.PendingHeadersCount.Set(float64(headersNb))
s.metrics.PendingDataCount.Set(float64(dataNb))
s.metrics.DASubmitterPendingBlobs.Set(float64(headersNb + dataNb))

Assessment: This is a reasonable suggestion for enhanced observability. The values are already calculated, so adding these metrics has minimal overhead. However:

Pros:

  • More granular monitoring (can see if backlog is headers vs data)
  • Helps diagnose issues (e.g., data submission stuck but headers flowing)
  • No performance impact (values already computed)

Cons:

  • Increases metric cardinality
  • Not strictly necessary if the total is what matters for alerting
  • Would require adding the new metrics to the Metrics struct

Recommendation: This could be a nice follow-up enhancement if granular monitoring is valuable for your use case, but it's not required for this fix to be correct. I'd suggest opening a separate issue to track this as a potential improvement.


Critical Issues 🔴

None identified. This is a clean, well-executed fix.


Minor Issues / Suggestions 🟡

  1. Metric Update Timing: The metric is now updated every checkInterval instead of on each submission. This is actually better, but worth noting in case someone expects real-time updates during rapid submissions.

  2. Test Coverage for Metrics: As mentioned above, adding a test that validates the metric behavior would strengthen confidence.

  3. Comment Enhancement: The comment at line 310-311 could be slightly more descriptive about why this location was chosen.


Conclusion ✅

This PR successfully fixes a significant bug in the DASubmitterPendingBlobs metric counting logic. The refactoring is well-executed, improves code clarity, and has minimal performance overhead. The change is low-risk and high-value.

Recommendation: APPROVE

The PR is ready to merge as-is. The optional enhancements (granular metrics, test coverage for metric behavior) can be addressed in follow-up work if desired.


Task List:

  • Read and analyze all changed files
  • Review core metric counting logic changes
  • Assess removed code and potential side effects
  • Evaluate test coverage modifications
  • Check documentation updates
  • Provide comprehensive feedback

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly refactors the logic for counting pending blobs for metrics. The previous implementation was flawed as it would overwrite the metric with either the pending header or data count, instead of their sum. The new logic moves the metric update to the daSubmissionLoop, where it is periodically and correctly updated with the total number of pending items. This is a solid fix. I've also suggested a small improvement to update two other related metrics for more granular monitoring.

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.43%. Comparing base (455b6c1) to head (9f498f5).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3038      +/-   ##
==========================================
+ Coverage   55.33%   55.43%   +0.09%     
==========================================
  Files         117      117              
  Lines       11685    11685              
==========================================
+ Hits         6466     6477      +11     
+ Misses       4494     4485       -9     
+ Partials      725      723       -2     
Flag Coverage Δ
combined 55.43% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@julienrbrt julienrbrt enabled auto-merge February 1, 2026 19:49
@julienrbrt julienrbrt added this pull request to the merge queue Feb 1, 2026
Merged via the queue into main with commit 9bc6311 Feb 1, 2026
27 of 29 checks passed
@julienrbrt julienrbrt deleted the julien/blob-metrics branch February 1, 2026 20:12
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-02-01 20:14 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants