Skip to content

Fix Source Code Extraction to Stack Traces (regression via rails) #2472

@chodges15

Description

@chodges15

Describe the idea
Currently, the Ruby Sentry SDK provides stack traces that include the file name, line number, and method name where an error occurred. However, it does not include the actual lines of source code. This feature is crucial for debugging, especially when dealing with third-party code, as it provides immediate context around the error without requiring developers to manually locate and open the files.

The feature request is to add functionality to the Ruby Sentry SDK to extract and include source code snippets in stack traces. This can be achieved by implementing a mechanism similar to the CodeExtractor class in the Bugsnag SDK, which reads the relevant files and attaches the surrounding lines of code to the stack trace.

Why do you think it's beneficial to most of the users

  1. Improved Debugging: Including source code snippets in stack traces allows developers to quickly understand the context of an error, making it easier to diagnose and fix issues.

  2. Third-Party Code: When errors occur in third-party libraries, developers may not be familiar with the code. Providing the surrounding lines of code helps them understand what might be going wrong without needing to dive into the third-party codebase.

  3. Efficiency: This feature saves time by reducing the need to manually locate and open files to see the relevant lines of code. It streamlines the debugging process and helps developers focus on solving the problem.

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions