Skip to content

publish metrics only when actually publishing #227

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

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

iuwqyir
Copy link
Collaborator

@iuwqyir iuwqyir commented Jun 11, 2025

TL;DR

Moved metrics collection from the Committer to the Publisher for more accurate timing and consolidated metrics reporting.

What changed?

  • Removed metrics collection for publishing duration from the Committer's goroutine
  • Moved the timing measurement for publishing to the Publisher itself
  • Consolidated all metrics reporting (block counter, last published block, reorg counter) to happen in one place within the Publisher
  • Fixed a bug where reorg metrics were only being recorded for old blocks, not new blocks

How to test?

  1. Run the application and verify that metrics are still being reported correctly
  2. Check that the publish_duration metric now accurately reflects the actual time spent in the Publisher.PublishBlockData method
  3. Verify that reorg metrics are properly recorded when a reorg occurs

Why make this change?

The previous implementation had inaccurate timing measurements since the metrics were being recorded in the Committer's goroutine rather than in the Publisher itself. This change ensures that the publish_duration metric accurately reflects the actual time spent publishing data. Additionally, consolidating all metrics reporting in one place makes the code more maintainable and ensures consistent metrics collection.

Copy link

coderabbitai bot commented Jun 11, 2025

Warning

Rate limit exceeded

@iuwqyir has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 28 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9f4504d and 34cef4e.

📒 Files selected for processing (2)
  • internal/orchestrator/committer.go (0 hunks)
  • internal/publisher/publisher.go (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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
Collaborator Author

iuwqyir commented Jun 11, 2025

@iuwqyir iuwqyir marked this pull request as ready for review June 11, 2025 20:40
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from 70ecf2e to edff81c Compare June 13, 2025 16:31
@iuwqyir iuwqyir force-pushed the 06-11-poll_new_blocks_in_the_committer_when_in_live_mode branch from 055b412 to 66f3a66 Compare June 13, 2025 16:31
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from edff81c to e5e4330 Compare June 13, 2025 16:36
@iuwqyir iuwqyir force-pushed the 06-11-poll_new_blocks_in_the_committer_when_in_live_mode branch 2 times, most recently from 4fafda1 to c3ca0b9 Compare June 13, 2025 16:41
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch 2 times, most recently from e39985a to f406ec4 Compare June 13, 2025 16:46
@iuwqyir iuwqyir force-pushed the 06-11-poll_new_blocks_in_the_committer_when_in_live_mode branch 2 times, most recently from 30d792b to 55d5c67 Compare June 13, 2025 16:54
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from f406ec4 to 514b78e Compare June 13, 2025 16:54
@iuwqyir iuwqyir force-pushed the 06-11-poll_new_blocks_in_the_committer_when_in_live_mode branch from 55d5c67 to 103b15d Compare June 13, 2025 16:56
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from 514b78e to 8407225 Compare June 13, 2025 16:56
@iuwqyir iuwqyir force-pushed the 06-11-poll_new_blocks_in_the_committer_when_in_live_mode branch from 103b15d to e238656 Compare June 13, 2025 17:08
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from 8407225 to 6505495 Compare June 13, 2025 17:08
@iuwqyir iuwqyir force-pushed the 06-11-poll_new_blocks_in_the_committer_when_in_live_mode branch 2 times, most recently from 95bc3d5 to cc624f5 Compare June 13, 2025 17:13
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from 6505495 to f334927 Compare June 13, 2025 17:13
@iuwqyir iuwqyir force-pushed the 06-11-poll_new_blocks_in_the_committer_when_in_live_mode branch from cc624f5 to abb607d Compare June 13, 2025 17:22
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from f334927 to 419d4ec Compare June 13, 2025 17:22
@iuwqyir iuwqyir changed the base branch from 06-11-poll_new_blocks_in_the_committer_when_in_live_mode to graphite-base/227 June 13, 2025 17:24
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from 419d4ec to d79c9a1 Compare June 13, 2025 17:24
@graphite-app graphite-app bot changed the base branch from graphite-base/227 to main June 13, 2025 17:25
@iuwqyir iuwqyir force-pushed the 06-11-publish_metrics_only_when_actually_publishing branch from d79c9a1 to 34cef4e Compare June 13, 2025 17:25
@iuwqyir iuwqyir merged commit 120b7e9 into main Jun 13, 2025
6 checks passed
@iuwqyir iuwqyir deleted the 06-11-publish_metrics_only_when_actually_publishing branch June 13, 2025 17:28
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.

2 participants