-
Notifications
You must be signed in to change notification settings - Fork 0
feat: block time duration for SLOs #24
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
Conversation
Summary of ChangesHello @auricom, 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 enhances the system's monitoring capabilities by introducing a new Prometheus Summary metric specifically for tracking block time durations. This addition allows for more granular analysis of block processing times through percentiles over a rolling window, which is essential for accurately defining and monitoring Service Level Objectives (SLOs) related to block production and reception. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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 introduces a new Prometheus summary metric, BlockTimeSummary, to track block time percentiles over a rolling window, likely for SLO monitoring. The changes include adding the metric definition, initializing it, and observing it when new block times are recorded.
My review includes two main points:
- A suggestion to clarify the purpose of the new summary metric in its help text, as summaries with a short
MaxAgeare better suited for real-time monitoring than long-term SLO tracking, for which histograms are generally preferred. - A recommendation to add unit tests for the
RecordBlockTimefunction, which is modified in this PR but currently lacks test coverage.
Overall, the changes are straightforward, but addressing these points will improve the clarity and robustness of the metrics implementation.
| // only record positive durations | ||
| if blockTime > 0 { | ||
| m.BlockTime.WithLabelValues(chainID).Observe(blockTime.Seconds()) | ||
| m.BlockTimeSummary.WithLabelValues(chainID).Observe(blockTime.Seconds()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RecordBlockTime function is modified here, but it appears to lack unit tests. To ensure the logic is correct and prevent future regressions, it would be beneficial to add tests in pkg/metrics/metrics_test.go.
Test cases could cover:
- The first call for a given
chainIDonly sets the arrival time and does not record a metric. - A subsequent call with a later
arrivalTimecorrectly records observations for bothBlockTimeandBlockTimeSummary. - A call with an earlier or identical
arrivalTimedoes not record any metric observation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
chatton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Overview