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

Development: Add Sentry reporting for the pipelines #135

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

Hialus
Copy link
Member

@Hialus Hialus commented Jul 1, 2024

Summary by CodeRabbit

  • Bug Fixes

    • Improved error logging in various pipelines to include exception details, enhancing troubleshooting and error resolution.
  • Chores

    • Enhanced error handling across multiple modules by integrating capture_exception from sentry_sdk for better error monitoring and reporting.

@Hialus Hialus self-assigned this Jul 1, 2024
@Hialus Hialus requested review from kaancayli and yassinsws and removed request for kaancayli July 1, 2024 12:54
Copy link
Contributor

coderabbitai bot commented Jul 1, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

This update enhances error handling and logging across several modules in the application. Exception details are now included in error messages, and capture_exception(e) from sentry_sdk has been integrated for better error monitoring. These improvements aid in capturing more diagnostic information during failures, thus facilitating more effective debugging and issue resolution.

Changes

Files and Paths Change Summary
app/pipeline/chat/course_chat_pipeline.py Updated error messages in lecture_content_retrieval to include exception details.
app/pipeline/chat/exercise_chat_pipeline.py Enhanced error handling in _run_exercise_chat_pipeline to log exceptions.
app/pipeline/lecture_ingestion_pipeline.py Improved error logging in __call__ and batch_update methods to include exception objects.
app/web/routers/pipelines.py Added capture_exception(e) after error logging, updated callback.error calls to include exception details.
app/web/routers/webhooks.py Added capture_exception import and capture_exception(e) in exception handling block.
app/web/status/status_update.py Updated error method in StatusUpdater to accept optional exception parameter and included capture_exception.

Sequence Diagram(s)

ExerciseChatPipeline Error Handling

sequenceDiagram
    participant User
    participant ChatPipeline as ExerciseChatPipeline
    participant Status as StatusUpdater
    participant Sentry as Sentry SDK

    User->>ChatPipeline: Execute Pipeline
    ChatPipeline->>ChatPipeline: _run_exercise_chat_pipeline()
    ChatPipeline->>ChatPipeline: Generates Exception (e)
    ChatPipeline->>Status: error("Failed to generate response: {e}", exception=e)
    Status->>Sentry: capture_exception(e)
    Status->>User: Return Error Response
Loading

LectureIngestionPipeline Error Handling

sequenceDiagram
    participant User
    participant LecturePipeline as LectureIngestionPipeline
    participant Status as StatusUpdater
    participant Sentry as Sentry SDK

    User->>LecturePipeline: Start Ingestion
    LecturePipeline->>LecturePipeline: __call__()
    LecturePipeline->>LecturePipeline: Generates Exception (e)
    LecturePipeline->>Status: error("Failed to ingest lectures: {e}", exception=e)
    Status->>Sentry: capture_exception(e)
    Status->>User: Return Error Response
Loading

Tip

AI model upgrade

gpt-4o model for reviews and chat is now live

OpenAI claims that this model is better at understanding and generating code than the previous models. Please join our Discord Community to provide any feedback or to report any issues.


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

Outside diff range and nitpick comments (4)
app/pipeline/lecture_ingestion_pipeline.py (4)

Line range hint 129-129: Rename unused loop control variable.

The loop control variable i is not used within the loop body. Rename i to _i to indicate it is unused.

-            for i, lecture_unit in enumerate(self.dto.lecture_units):
+            for _i, lecture_unit in enumerate(self.dto.lecture_units):

Line range hint 162-163: Use a single with statement for multiple contexts.

Use a single with statement with multiple contexts instead of nested with statements.

-            with self.collection.batch.rate_limit(requests_per_minute=600) as batch:
-                try:
-                    for index, chunk in enumerate(chunks):
+            with self.collection.batch.rate_limit(requests_per_minute=600) as batch, batch:
+                try:
+                    for _index, chunk in enumerate(chunks):

Line range hint 165-165: Rename unused loop control variable.

The loop control variable index is not used within the loop body. Rename index to _index to indicate it is unused.

-                    for index, chunk in enumerate(chunks):
+                    for _index, chunk in enumerate(chunks):

Line range hint 263-263: Remove unnecessary open mode parameters.

The open mode parameters are unnecessary and can be removed.

-        with open(prompt_file_path, "r") as file:
+        with open(prompt_file_path) as file:

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 1, 2024
@Hialus Hialus added this to the 1.1.0 milestone Jul 1, 2024
MichaelOwenDyer
MichaelOwenDyer previously approved these changes Jul 3, 2024
Copy link
Contributor

@MichaelOwenDyer MichaelOwenDyer left a comment

Choose a reason for hiding this comment

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

Great, thank you for implementing this

# Conflicts:
#	app/pipeline/chat/course_chat_pipeline.py
@Hialus Hialus dismissed stale reviews from MichaelOwenDyer and coderabbitai[bot] via 1b05599 July 3, 2024 15:23
@Hialus Hialus merged commit 80c183f into main Jul 3, 2024
4 checks passed
@Hialus Hialus deleted the feature/sentry-pipeline-support branch July 3, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants