Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add active validators gauge for consumers #68

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

freak12techno
Copy link
Collaborator

@freak12techno freak12techno commented Jun 27, 2024

Summary by CodeRabbit

  • New Features

    • Introduced ValidatorActiveGenerator to generate Prometheus metrics for active validators.
  • Bug Fixes

    • Updated logger component names for better clarity across various fetchers (ConsumerInfoFetcher, ConsumerValidatorsFetcher, ValidatorConsumersFetcher, SigningInfoFetcher).
  • Improvements

    • Removed unused isActiveGauge metric from SingleValidatorInfoGenerator.
    • Adjusted test assertions to reflect the removal of the isActiveGauge metric.

Copy link
Contributor

coderabbitai bot commented Jun 27, 2024

Walkthrough

The overall change introduces a new ValidatorActiveGenerator to generate Prometheus metrics for active validators. It also standardizes logger component names across various fetchers, and refactors existing SingleValidatorInfoGenerator by removing the isActiveGauge metric. These changes enhance logging clarity, support metric generation for validators, and update associated unit tests.

Changes

File Path Change Summary
pkg/app.go Added NewValidatorActiveGenerator call to NewApp function to create active validator generator.
pkg/fetchers/consumer_info.go Updated logger component identifier from "validators_fetcher" to "consumer_info_fetcher".
pkg/fetchers/consumer_validators.go Changed logger component from "validators_fetcher" to "consumer_validators_fetcher".
pkg/fetchers/has_to_validate.go Modified logger component from "node_info_fetcher" to "validator_consumers_fetcher".
pkg/fetchers/signing_info.go Updated logger component string from "signing_infos" to "signing_infos_fetcher".
pkg/generators/validator_active.go Introduced ValidatorActiveGenerator to generate metrics for active validators.
pkg/generators/validator_active_test.go Added unit tests for ValidatorActiveGenerator.
pkg/generators/single_validator_info.go Removed isActiveGauge metric from SingleValidatorInfoGenerator.
pkg/generators/single_validator_info_test.go Adjusted test assertions to account for the removal of isActiveGauge metric.

Poem

In the code where metrics thrive,
Validator active now comes alive,
Logging clear, succinct, and bright,
Fetchers labeled just right.
Prometheus smiles with new zest,
As the changes pass the test.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

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

Project coverage is 90.71%. Comparing base (d6594f6) to head (503714c).

Files Patch % Lines
pkg/app.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
+ Coverage   90.54%   90.71%   +0.16%     
==========================================
  Files          60       61       +1     
  Lines        2402     2455      +53     
==========================================
+ Hits         2175     2227      +52     
- Misses        226      227       +1     
  Partials        1        1              

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d6594f6 and 503714c.

Files selected for processing (9)
  • pkg/app.go (1 hunks)
  • pkg/fetchers/consumer_info.go (1 hunks)
  • pkg/fetchers/consumer_validators.go (1 hunks)
  • pkg/fetchers/has_to_validate.go (1 hunks)
  • pkg/fetchers/signing_info.go (1 hunks)
  • pkg/generators/single_validator_info.go (3 hunks)
  • pkg/generators/single_validator_info_test.go (3 hunks)
  • pkg/generators/validator_active.go (1 hunks)
  • pkg/generators/validator_active_test.go (1 hunks)
Files not reviewed due to errors (2)
  • pkg/generators/single_validator_info_test.go (no review received)
  • pkg/generators/validator_active_test.go (no review received)
Files skipped from review due to trivial changes (3)
  • pkg/fetchers/consumer_info.go
  • pkg/fetchers/consumer_validators.go
  • pkg/generators/single_validator_info.go
Additional context used
GitHub Check: codecov/patch
pkg/app.go

[warning] 122-122: pkg/app.go#L122
Added line #L122 was not covered by tests

Additional comments not posted (3)
pkg/fetchers/has_to_validate.go (1)

39-39: Logger component name updated for clarity.

The change from a generic or incorrect logger name to validator_consumers_fetcher improves the clarity and traceability of log messages, which is especially useful for debugging and monitoring.

pkg/generators/validator_active.go (1)

27-27: Logger component name set appropriately in the constructor.

Setting the logger component name to validator_active_generator helps in identifying logs specific to this generator, which is crucial for debugging and maintenance.

pkg/fetchers/signing_info.go (1)

40-40: Logger component name updated for better specificity.

Updating the logger component name to signing_infos_fetcher enhances the specificity and traceability of log messages, aiding in debugging and operational monitoring.

pkg/app.go Show resolved Hide resolved
pkg/generators/validator_active.go Show resolved Hide resolved
@freak12techno freak12techno merged commit 95d607b into main Jun 27, 2024
8 checks passed
@freak12techno freak12techno deleted the add-active-validator-gauge branch June 27, 2024 04:12
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.

1 participant