Skip to content

Improve Sentry Implementation for Better Parameter and Stack Trace Handling #432

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

Closed
chibie opened this issue Mar 4, 2025 · 1 comment · Fixed by #459
Closed

Improve Sentry Implementation for Better Parameter and Stack Trace Handling #432

chibie opened this issue Mar 4, 2025 · 1 comment · Fixed by #459
Assignees

Comments

@chibie
Copy link
Contributor

chibie commented Mar 4, 2025

Description

Currently, Sentry logs are not capturing parameters and stack traces effectively, making it difficult to debug issues. The implementation should be improved to properly pass parameters and stack traces to Sentry, following best practices outlined in the Sentry Go documentation.

Acceptance Criteria

  1. GIVEN an error is logged
    WHEN the error is sent to Sentry
    THEN it should include all relevant parameters and a stack trace

  2. GIVEN an error is logged
    WHEN the error is sent to Sentry
    THEN the error message should be structured and easy to parse in Sentry

  3. GIVEN an error is logged
    WHEN the error is sent to Sentry
    THEN the stack trace should be captured and included in the Sentry event

  4. GIVEN the application is running in production or staging
    WHEN an error occurs
    THEN the error should be logged to Sentry with the correct context and metadata

Tech Details

  • Sentry Configuration:

    • Update the Sentry initialization to include additional configuration options for better error handling.
    • Ensure stack traces are captured by enabling the AttachStacktrace option.
  • Logging Improvements:

    • Use Sentry's CaptureException or CaptureMessage methods to log errors with structured data.
    • Pass additional context (e.g., order ID, provider ID) as tags or extra data in Sentry events.
  • Stack Trace Handling:

    • Ensure stack traces are included in Sentry events by using WithScope or ConfigureScope.
  • Error Wrapping:

    • Wrap errors with additional context to provide more detailed error messages.

Notes/Assumptions

  • The Sentry DSN and environment are already configured in the server configuration.
  • The application is already using logrus for logging, which is integrated with Sentry via the sentryhook.

Open Questions

@tarun-khatri
Copy link

I’d like to help with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment