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

docs: add metrics configuration #468

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

docs: add metrics configuration #468

wants to merge 4 commits into from

Conversation

tuxcanfly
Copy link
Contributor

@tuxcanfly tuxcanfly commented Sep 27, 2024

Overview

Fixes #431

Summary by CodeRabbit

  • New Features

    • Introduced documentation for configuring Prometheus metrics in Rollkit.
    • Users can enable metrics reporting and access metrics at the /metrics endpoint.
  • Documentation

    • Added a section on "Centralized Sequencer Node" with configuration details and metrics reporting instructions.
    • Comprehensive list of available metrics with descriptions, enhancing usability for monitoring and analysis.

Copy link
Contributor

coderabbitai bot commented Sep 27, 2024

Walkthrough

The changes enhance the documentation in guides/metrics.md and learn/centralized-sequencer-node.md. The former provides detailed instructions on configuring and using Prometheus metrics within the Rollkit framework, including enabling metrics reporting and a comprehensive list of available metrics. The latter introduces a new section on the centralized-sequencer node, detailing its configuration options and the ability to report Prometheus metrics.

Changes

Files Change Summary
guides/metrics.md Added documentation for configuring Prometheus metrics, including enabling metrics and listing available metrics.
learn/centralized-sequencer-node.md Added a section on the centralized sequencer node, detailing configuration flags and available Prometheus metrics.

Assessment against linked issues

Objective Addressed Explanation
Document how to use Rollkit metrics (#431)

🐰 In the meadow, metrics bloom,
With Prometheus, we dispel the gloom.
Set the flag, let data flow,
At /metrics, watch it grow!
Rollkit's guide, a treasure to find,
For curious minds, so well-defined! 🌼


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

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: 1

🧹 Outside diff range and nitpick comments (3)
guides/metrics.md (3)

1-9: LGTM! Consider adding more context.

The introduction provides a clear and concise overview of Rollkit's Prometheus metrics functionality. To enhance user understanding, consider adding a brief explanation of why metrics are useful and how they can benefit users of Rollkit.


10-14: Remove unnecessary backslashes in config parameter.

The instructions for enabling metrics are clear. However, there's a minor formatting issue in the config parameter name.

Apply this change to line 13:

-`instrumentation.prometheus\_listen\_addr`).
+`instrumentation.prometheus_listen_addr`).

This removes the unnecessary backslashes, as Markdown doesn't require escaping underscores within backticks.

🧰 Tools
🪛 LanguageTool

[grammar] ~11-~11: It looks like there is a word missing here. Did you mean “Listen to address”?
Context: ...er /metrics on 26660 port by default. Listen address can be changed in the config file (see ...

(LISTEN_TO_ME)


1-25: Expand documentation to fully address PR objectives.

While this document provides a good starting point for Rollkit metrics configuration, it could be expanded to fully meet the objectives outlined in issue #431. Consider adding the following sections to align more closely with the CometBFT metrics documentation:

  1. A brief introduction explaining the importance of metrics in Rollkit.
  2. More detailed configuration options, if available (e.g., setting custom ports, adjusting reporting intervals).
  3. Examples of how to query these metrics using Prometheus.
  4. Best practices for monitoring Rollkit using these metrics.
  5. Any known limitations or considerations when using metrics in Rollkit.

Adding these sections would provide a more comprehensive guide for users looking to leverage Rollkit metrics effectively.

🧰 Tools
🪛 LanguageTool

[grammar] ~11-~11: It looks like there is a word missing here. Did you mean “Listen to address”?
Context: ...er /metrics on 26660 port by default. Listen address can be changed in the config file (see ...

(LISTEN_TO_ME)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f8bc44c and 27bb078.

📒 Files selected for processing (1)
  • guides/metrics.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
guides/metrics.md

[grammar] ~11-~11: It looks like there is a word missing here. Did you mean “Listen to address”?
Context: ...er /metrics on 26660 port by default. Listen address can be changed in the config file (see ...

(LISTEN_TO_ME)

🔇 Additional comments (1)
guides/metrics.md (1)

15-20: LGTM! Clear and well-structured table header.

The table header provides a clear structure for presenting the metrics information. It includes all necessary columns: Name, Type, Tags, and Description.

Comment on lines 21 to 25
| gas_price | Gauge | | Gas Price of the DA transaction |
| last_blob_size | Gauge | | Last blob size submitted to the DA |
| transaction_status | Gauge | | Tranasction status of the DA transaction |
| num_pending_blocks | Gauge | | Number of blocks pending DA submission |
| included_block_height | Gauge | | Block height of the last DA transaction |
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Correct typo and improve metric descriptions.

There's a typo in the description of the "transaction_status" metric, and some descriptions could be more informative.

  1. Correct the typo in line 23:
-| transaction_status                         | Gauge     |                  | Tranasction status of the DA transaction                                   |
+| transaction_status                         | Gauge     |                  | Transaction status of the DA transaction                                   |
  1. Consider improving the following descriptions for clarity:
    • gas_price: "Current gas price for DA transactions"
    • last_blob_size: "Size of the most recent blob submitted to the DA layer"
    • num_pending_blocks: "Number of blocks waiting for DA submission"
    • included_block_height: "Height of the most recent block included in a DA transaction"

These changes provide more specific information about what each metric represents.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| gas_price | Gauge | | Gas Price of the DA transaction |
| last_blob_size | Gauge | | Last blob size submitted to the DA |
| transaction_status | Gauge | | Tranasction status of the DA transaction |
| num_pending_blocks | Gauge | | Number of blocks pending DA submission |
| included_block_height | Gauge | | Block height of the last DA transaction |
| gas_price | Gauge | | Current gas price for DA transactions |
| last_blob_size | Gauge | | Size of the most recent blob submitted to the DA layer |
| transaction_status | Gauge | | Transaction status of the DA transaction |
| num_pending_blocks | Gauge | | Number of blocks waiting for DA submission |
| included_block_height | Gauge | | Height of the most recent block included in a DA transaction |

@MSevey
Copy link
Contributor

MSevey commented Sep 27, 2024

docs preview is failing: https://github.com/rollkit/docs/actions/runs/11072258066/job/30766061486?pr=468

but it looks like something broke it previously https://github.com/rollkit/docs/actions/workflows/preview.yml

Let's fix this so we can see how this update renders.

@MSevey
Copy link
Contributor

MSevey commented Sep 27, 2024

Tracking build failure here: #469

Copy link
Contributor

github-actions bot commented Sep 30, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://rollkit.github.io/docs-preview/./pr-468/
on branch main at 2024-10-11 13:42 UTC

This functionality is disabled by default.

To enable the Prometheus metrics, set `instrumentation.prometheus=true` in your
config file. Metrics will be served under `/metrics` on 26660 port by default.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a dumb question - but which file exactly?

Copy link
Contributor

Choose a reason for hiding this comment

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

rollkit.toml?

Copy link
Contributor

@MSevey MSevey left a comment

Choose a reason for hiding this comment

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

The page isn't linked to the site yet https://rollkit.github.io/docs-preview/pr-468/guides/overview

You need to add it to the menu.

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: 1

🧹 Outside diff range and nitpick comments (5)
learn/centralized-sequencer-node.md (3)

1-18: Enhance readability with minor formatting adjustments

The introduction and configuration table are informative and well-structured. Consider the following suggestions to improve clarity:

  1. Add a brief description of what a centralized sequencer is and its role in the system.
  2. Consider adding a blank line between the table header and the first row for better readability.
  3. Align the default values in the table for consistency.

Here's a suggested improvement for the table formatting:

| Flag             | Usage                                                    | Default                  |
|------------------|-------------------------------------------------------------|--------------------------|
| `batch-time`     | Time in seconds to wait before generating a new batch       | 2 seconds                |
| `da_address`     | DA address                                                  | `http://localhost:26658` |
| `da_auth_token`  | Auth token for the DA                                       | `""`                     |
| `da_namespace`   | DA namespace where the sequencer submits transactions       | `""`                     |
| `host`           | Centralized sequencer host                                  | localhost                |
| `port`           | Centralized sequencer port                                  | 50051                    |
| `listen-all`     | Listen on all network interfaces instead of just localhost  | disabled                 |
| `metrics`        | Enable Prometheus metrics                                   | disabled                 |
| `metrics-address`| Address to expose Prometheus metrics                        | `":8080"`                |

20-21: Improve metrics introduction formatting and grammar

The metrics introduction provides valuable information but could be improved for clarity:

  1. Consider using a bullet point list for better readability.
  2. There's a minor grammatical issue in the second sentence.

Here's a suggested improvement:

The `centralized-sequencer` node reports Prometheus metrics when the `-metrics` flag is enabled:

- By default, metrics are exported to `http://localhost:8080/metrics`.
- The listen address and port can be configured with the `-metrics-address` flag.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~20-~20: Did you mean: “By default,”?
Context: ...cs when the -metrics flag is enabled. By default metrics are exported to `http://localho...

(BY_DEFAULT_COMMA)


[grammar] ~21-~21: It looks like there is a word missing here. Did you mean “listen to address”?
Context: ...to http://localhost:8080/metrics, the listen address and port can be configured with `-metri...

(LISTEN_TO_ME)


1-31: Enhance document with additional context and usage information

The document provides valuable information about the Centralized Sequencer Node, its configuration, and metrics. To make it even more useful for users, consider adding the following:

  1. A brief conclusion or summary that ties together the configuration options and metrics.
  2. Information on how to interpret and use these metrics for monitoring and troubleshooting.
  3. Examples of common use cases or scenarios where these metrics would be particularly useful.
  4. Links to related documentation or resources for further reading.

Here's a suggested addition to the end of the document:

### Interpreting and Using Metrics

The provided metrics offer insights into the performance and status of your Centralized Sequencer Node:

- Use `gas_price` and `last_blob_size` to monitor resource usage and optimize costs.
- Track `transaction_status` and `num_pending_blocks` to identify potential bottlenecks or issues in the sequencing process.
- Monitor `included_block_height` to ensure your node is keeping up with the network.

For more information on optimizing your Centralized Sequencer Node and interpreting these metrics, refer to our [Advanced Monitoring Guide](link-to-guide).
🧰 Tools
🪛 LanguageTool

[uncategorized] ~20-~20: Did you mean: “By default,”?
Context: ...cs when the -metrics flag is enabled. By default metrics are exported to `http://localho...

(BY_DEFAULT_COMMA)


[grammar] ~21-~21: It looks like there is a word missing here. Did you mean “listen to address”?
Context: ...to http://localhost:8080/metrics, the listen address and port can be configured with `-metri...

(LISTEN_TO_ME)

guides/metrics.md (2)

1-13: LGTM! Consider adding a configuration file example.

The "How to configure metrics" section provides clear and concise instructions for enabling and configuring Prometheus metrics in Rollkit. The information is accurate and helpful for users.

To further enhance this section, consider adding a small example snippet of the configuration file showing how to enable metrics and set the listen address. This would provide a concrete reference for users.

🧰 Tools
🪛 LanguageTool

[grammar] ~11-~11: It looks like there is a word missing here. Did you mean “Listen to address”?
Context: ...er /metrics on 26660 port by default. Listen address can be changed in the config file (see ...

(LISTEN_TO_ME)


15-54: LGTM! Consider minor formatting improvements for consistency.

The "List of available metrics" section provides a comprehensive and well-structured table of available metrics. Each metric is clearly described with its name, type, tags, and description, which is very helpful for users.

To improve consistency and readability:

  1. Consider using consistent capitalization in the "Description" column. For example:

    • "Height of the chain" -> "Height of the chain"
    • "Number of validators" -> "Number of validators"
    • "Total voting power of all validators" -> "Total voting power of all validators"
  2. Ensure consistent use of periods at the end of descriptions. Currently, some descriptions end with periods while others don't.

These minor adjustments will enhance the overall presentation of the metrics table.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~26-~26: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ... | Gauge | | Total amount of blocks missed for the node, if the n...

(AMOUNTOF_TO_NUMBEROF)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 27bb078 and 5230d42.

📒 Files selected for processing (2)
  • guides/metrics.md (1 hunks)
  • learn/centralized-sequencer-node.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
guides/metrics.md

[grammar] ~11-~11: It looks like there is a word missing here. Did you mean “Listen to address”?
Context: ...er /metrics on 26660 port by default. Listen address can be changed in the config file (see ...

(LISTEN_TO_ME)


[uncategorized] ~26-~26: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ... | Gauge | | Total amount of blocks missed for the node, if the n...

(AMOUNTOF_TO_NUMBEROF)

learn/centralized-sequencer-node.md

[uncategorized] ~20-~20: Did you mean: “By default,”?
Context: ...cs when the -metrics flag is enabled. By default metrics are exported to `http://localho...

(BY_DEFAULT_COMMA)


[grammar] ~21-~21: It looks like there is a word missing here. Did you mean “listen to address”?
Context: ...to http://localhost:8080/metrics, the listen address and port can be configured with `-metri...

(LISTEN_TO_ME)

🔇 Additional comments (1)
guides/metrics.md (1)

1-54: Great job on the metrics documentation!

This new file provides excellent documentation on configuring and using Prometheus metrics in Rollkit. The content is well-structured, informative, and easy to follow. It covers both the configuration process and a comprehensive list of available metrics, which will be very helpful for users implementing monitoring solutions.

The minor suggestions provided in the previous comments (adding a configuration example and improving formatting consistency) would further enhance the already high-quality document. Overall, this is a valuable addition to the Rollkit documentation.

🧰 Tools
🪛 LanguageTool

[grammar] ~11-~11: It looks like there is a word missing here. Did you mean “Listen to address”?
Context: ...er /metrics on 26660 port by default. Listen address can be changed in the config file (see ...

(LISTEN_TO_ME)


[uncategorized] ~26-~26: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ... | Gauge | | Total amount of blocks missed for the node, if the n...

(AMOUNTOF_TO_NUMBEROF)

Comment on lines +23 to +31
The following metrics are available:

| **Name** | **Type** | **Tags** | **Description** |
|--------------------------------------------|-----------|------------------|------------------------------------------------------------------------|
| gas_price | Gauge | | Gas Price of the DA transaction |
| last_blob_size | Gauge | | Last blob size submitted to the DA |
| transaction_status | Gauge | | Tranasction status of the DA transaction |
| num_pending_blocks | Gauge | | Number of blocks pending DA submission |
| included_block_height | Gauge | | Block height of the last DA transaction |
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typo and enhance metrics table

The metrics table is informative and well-structured. However, there's a typo in one of the descriptions:

  1. In the "transaction_status" row, "Tranasction" should be "Transaction".

Also, consider adding units to the "last_blob_size" metric for clarity.

Here's the corrected and improved version of the affected row:

| transaction_status                         | Gauge     |                  | Transaction status of the DA transaction                                  |
| last_blob_size                             | Gauge     |                  | Last blob size submitted to the DA (in bytes)                             |

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.

Document how to use Rollkit metrics
3 participants