Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Conversation

@auricom
Copy link
Contributor

@auricom auricom commented Feb 17, 2025

Overview

Fixes an issue that occurs when batch posting, with metrics enabled :

centralized-sequencer  | panic: inconsistent label cardinality: expected 1 label values but got 2 in prometheus.Labels{"chain_id":"000000000000000000000000000000000000002777d4d961c75a526dd8", "status":"1"}
centralized-sequencer  | 
centralized-sequencer  | goroutine 94 [running]:
centralized-sequencer  | github.com/prometheus/client_golang/prometheus.(*CounterVec).With(...)
centralized-sequencer  |        /go/pkg/mod/github.com/prometheus/client_golang@v1.20.4/prometheus/counter.go:296
centralized-sequencer  | github.com/go-kit/kit/metrics/prometheus.(*Counter).Add(0xc000682ba0, 0x3ff0000000000000)
centralized-sequencer  |        /go/pkg/mod/github.com/go-kit/kit@v0.13.0/metrics/prometheus/prometheus.go:45 +0x131
centralized-sequencer  | github.com/rollkit/centralized-sequencer/sequencing.(*Sequencer).recordMetrics(0xc0006a16b0, 0x0?, 0xfc, 0x1, 0x0, 0x483eb3)
centralized-sequencer  |        /src/centralized-sequencer/sequencing/sequencer.go:491 +0x16b
centralized-sequencer  | github.com/rollkit/centralized-sequencer/sequencing.(*Sequencer).submitBatchToDA(0xc0006a16b0, {{0xc006bd9320, 0x1, 0x1}})
centralized-sequencer  |        /src/centralized-sequencer/sequencing/sequencer.go:558 +0xe5
centralized-sequencer  | github.com/rollkit/centralized-sequencer/sequencing.(*Sequencer).publishBatch(0xc0006a16b0)
centralized-sequencer  |        /src/centralized-sequencer/sequencing/sequencer.go:471 +0x59
centralized-sequencer  | github.com/rollkit/centralized-sequencer/sequencing.(*Sequencer).batchSubmissionLoop(0xc0006a16b0, {0x12c9210, 0x1abca20})
centralized-sequencer  |        /src/centralized-sequencer/sequencing/sequencer.go:458 +0x14d
centralized-sequencer  | created by github.com/rollkit/centralized-sequencer/sequencing.NewSequencer in goroutine 1
centralized-sequencer  |        /src/centralized-sequencer/sequencing/sequencer.go:348 +0x745
centralized-sequencer exited with code 0

Summary by CodeRabbit

  • New Features
    • Enhanced transaction monitoring: Our metrics now offer detailed status insights for transactions, providing improved visibility into operational performance.

@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2025

Walkthrough

A modification was made in the sequencing/metrics.go file. The PrometheusMetrics function now appends a new "status" label to the labels slice when creating the TransactionStatus metric. This change adjusts the metric’s label configuration, enabling tracking based on transaction status. No other functional logic or error handling was altered.

Changes

File Change Summary
sequencing/metrics.go Modified PrometheusMetrics to append the "status" label for TransactionStatus metric

Poem

I'm a bouncy bunny, leaping with delight,
Coding through the night, a metric shining bright.
With a new "status" label added in a snap,
My transactions now wear a colorful cap.
Hop along the code trail, quick and free—
Celebrating changes in metrics with glee! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70a0183 and 3cf91a5.

📒 Files selected for processing (1)
  • sequencing/metrics.go (1 hunks)
🔇 Additional comments (2)
sequencing/metrics.go (2)

76-76: LGTM! This change fixes the label cardinality panic.

The fix correctly adds the "status" label to the metric's configuration, ensuring that the Prometheus CounterVec expects and accepts status values during metrics collection. This resolves the panic that occurred due to inconsistent label cardinality.


72-76:

Details

✅ Verification successful

Verify existing metrics collection code.

Please ensure that all code paths that increment this metric provide a value for the "status" label. The metric now requires a status value to be set.

Let's search for all usages of this metric to verify they're updated:


🏁 Script executed:

#!/bin/bash
# Search for TransactionStatus metric usage
rg -A 5 'TransactionStatus\.' 

Length of output: 390


Metric Usage Verified – No Further Changes Required

The search confirmed that the only code path incrementing TransactionStatus (in sequencing/sequencer.go) consistently provides a "status" label:

  • sequencing/sequencer.go: c.metrics.TransactionStatus.With("status", fmt.Sprintf("%d", statusCode)).Add(1)

No additional code paths are incrementing this metric without the required "status" label.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@RollkitBot RollkitBot requested review from a team, Manav-Aggarwal, gupadhyaya and tuxcanfly and removed request for a team February 17, 2025 13:49
@codecov
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (main@67b7c6c). Learn more about missing BASE report.

Files with missing lines Patch % Lines
sequencing/metrics.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #53   +/-   ##
=======================================
  Coverage        ?   43.43%           
=======================================
  Files           ?        4           
  Lines           ?      739           
  Branches        ?        0           
=======================================
  Hits            ?      321           
  Misses          ?      380           
  Partials        ?       38           

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

@tac0turtle tac0turtle enabled auto-merge (squash) February 24, 2025 14:53
@tac0turtle tac0turtle merged commit 7d8ea96 into evstack:main Feb 24, 2025
10 checks passed
@github-actions
Copy link

🎉 This PR is included in version 0.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@tac0turtle tac0turtle removed this from Evolve Apr 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants