Skip to content

Feat: Add Sentry monitoring for runtime exception capture (#823)#884

Open
Delightech28 wants to merge 2 commits into
Fracverse:masterfrom
Delightech28:feature/823-sentry-monitoring
Open

Feat: Add Sentry monitoring for runtime exception capture (#823)#884
Delightech28 wants to merge 2 commits into
Fracverse:masterfrom
Delightech28:feature/823-sentry-monitoring

Conversation

@Delightech28

Copy link
Copy Markdown

Description

This PR integrates Sentry monitoring for runtime exception capture into the backend, addressing #823.

Changes Made

  • Dependencies: Added sentry, sentry-tracing, and sentry-tower crates.
  • Configuration: Added support for loading the SENTRY_DSN from environment variables.
  • Initialization: Initialized the Sentry client in main.rs before initializing telemetry to capture all early errors. The Sentry guard is maintained for the application's lifecycle to ensure asynchronous error reporting.
  • Tracing Integration: Added sentry_tracing::layer() to the tracing subscriber in telemetry.rs to automatically capture error! level events.
  • Middleware:
    • Attached sentry_tower::NewSentryLayer and sentry_tower::SentryHttpLayer to the Axum Router to automatically extract request contexts (client IP, HTTP headers, etc.).
    • Updated jwt_auth_middleware and signature_auth_middleware in auth.rs to utilize sentry::configure_scope() for injecting the active user_id context.

Acceptance Criteria Met

  • Exceptions are caught and reported to Sentry dashboard automatically via tracing integration.
  • Includes context such as client IP, user ID, and stack traces.
  • No performance penalty or main-thread block on report delivery (Sentry operates in a background thread).

How to Test

  1. Set the SENTRY_DSN environment variable in your .env file.
  2. Trigger an unhandled error or a tracing::error! log.
  3. Verify that the event successfully appears in your Sentry dashboard alongside the user ID, request data, and client IP.

closes #823

@ONEONUORA

Copy link
Copy Markdown
Contributor

@Delightech28
Run cargo fmt --all -- --check
and clippy

@ONEONUORA

Copy link
Copy Markdown
Contributor

@Delightech28
Update on this Pr
you will be unassign in 6hrs

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Delightech28 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ONEONUORA

Copy link
Copy Markdown
Contributor

@Delightech28

Run cargo clippy --all-targets --all-features -- -D warnings

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.

[Backend] Monitoring: Integrate Sentry Exception Tracking

2 participants