Skip to content

Conversation

@alexeyr-ci
Copy link
Contributor

@alexeyr-ci alexeyr-ci commented Dec 8, 2024

With this change we get in development:

[2024-12-08 12:54:47.400 +0300] INFO (RORP): Scheduled workers restarts every 10 minutes (1 minutes btw each)
    process: "primary"
[2024-12-08 12:54:47.738 +0300] INFO (RORP): Listening on port 3800!
    process: "worker #3"
[2024-12-08 12:54:47.760 +0300] INFO (RORP): Listening on port 3800!
    process: "worker #1"
[2024-12-08 12:54:47.764 +0300] INFO (RORP): Listening on port 3800!
    process: "worker #2"

compared to [2024-12-08 12:54:47.764 +0300] INFO (RORP): Worker #2 listening on port 3800!. The benefit is that all log messages (and integrations) now include worker ID.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced globalContext for enhanced error reporting and logging across integrations.
    • Improved integration instructions for Sentry and Bugsnag, including detailed setup for tracing.
  • Bug Fixes

    • Streamlined error handling and logging in various components, enhancing clarity and context.
  • Documentation

    • Updated documentation for error reporting and tracing, clarifying integration steps for Sentry and Bugsnag.
  • Refactor

    • Simplified logging and error messaging by removing unnecessary complexity related to worker IDs in logs.

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2024

Warning

Rate limit exceeded

@alexeyr-ci has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 36 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 b0159a1 and 3c3c6c1.

📒 Files selected for processing (11)
  • docs/node-renderer/error-reporting-and-tracing.md (1 hunks)
  • packages/node-renderer/src/integrations/api.ts (1 hunks)
  • packages/node-renderer/src/integrations/honeybadger.ts (1 hunks)
  • packages/node-renderer/src/integrations/sentry.ts (2 hunks)
  • packages/node-renderer/src/integrations/sentry6.ts (2 hunks)
  • packages/node-renderer/src/shared/locks.ts (3 hunks)
  • packages/node-renderer/src/shared/log.ts (2 hunks)
  • packages/node-renderer/src/shared/utils.ts (0 hunks)
  • packages/node-renderer/src/worker.ts (3 hunks)
  • packages/node-renderer/src/worker/handleRenderRequest.ts (4 hunks)
  • packages/node-renderer/src/worker/vm.ts (3 hunks)

Walkthrough

The changes in this pull request focus on enhancing the documentation and implementation of error reporting and tracing for Sentry and Bugsnag integrations within the Node renderer. Key updates include the introduction of a globalContext variable for richer context in error reports, clarifications in the initialization instructions for Sentry, and modifications to the Bugsnag integration to utilize this new context. Additionally, various improvements were made to logging and error handling across several files, streamlining the code and enhancing clarity without altering existing functionalities.

Changes

File Path Change Summary
docs/node-renderer/error-reporting-and-tracing.md Updated integration instructions for Sentry and Bugsnag; introduced globalContext for error reporting context; clarified Sentry initialization and tracing setup for various SDK versions.
packages/node-renderer/src/integrations/api.ts Added export for globalContext; updated error reporting exports to include message and error.
packages/node-renderer/src/integrations/honeybadger.ts Changed import to namespace import for Honeybadger; modified init function to set global context in notifications.
packages/node-renderer/src/integrations/sentry.ts Enhanced Sentry integration with globalContext; added import for getGlobalScope to set global context in error reporting.
packages/node-renderer/src/integrations/sentry6.ts Improved Sentry tracing integration with globalContext; updated error and message notifiers to use tracing context; refined error handling for module loading.
packages/node-renderer/src/shared/locks.ts Enhanced logging; integrated cluster support; simplified log messages to focus on lockfile name without worker ID.
packages/node-renderer/src/shared/log.ts Added globalContext export; modified logger configuration to include process context in logs.
packages/node-renderer/src/shared/utils.ts Removed workerIdLabel function, simplifying the utility functions.
packages/node-renderer/src/worker.ts Updated error handling to remove worker ID from logs; refined logging for non-200 status codes.
packages/node-renderer/src/worker/handleRenderRequest.ts Streamlined error handling and logging; removed workerIdLabel references from error messages.
packages/node-renderer/src/worker/vm.ts Removed cluster module import; simplified runInVM function signature and logging.
spec/dummy/client/node-renderer.js Updated Honeybadger initialization to pass Honeybadger instance as an argument in the init method.

Poem

🐇 In the meadow, we hop with glee,
New changes bloom like flowers, you see.
With Sentry and Bugsnag, our errors now sing,
Global context added, what joy it will bring!
So let’s celebrate with a leap and a bound,
In the world of code, new treasures abound! 🌼


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/worker-id-logging branch 2 times, most recently from afc9469 to b0159a1 Compare December 8, 2024 09:50
};

export async function unlock(lockfileName: string) {
debug('Worker %s: About to unlock %s', workerIdLabel(), lockfileName);
Copy link
Contributor Author

@alexeyr-ci alexeyr-ci Dec 8, 2024

Choose a reason for hiding this comment

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

Here we have both debug and log.info with the same message, I kept only those debug calls which don't have corresponding log. Or maybe better to keep it for symmetry?

* Context that should be included in every log message (including integrations).
*/
export const globalContext = {
process: cluster.isPrimary ? 'primary' : `worker #${cluster.worker?.id}`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could make empty for primary and worker: cluster.worker?.id for worker.

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/worker-id-logging branch from b0159a1 to 3c3c6c1 Compare December 8, 2024 09:58
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.

3 participants