Skip to content

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

Closed
@chibie

Description

@chibie

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions