getsentry / getsentry/sentry

Attach source context to stack trace when VCS integration exists

Open
#85,670 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
22h 21m
Merged PRs (30d)
586

Description

In cases where link to VCS exists for a specific version (e.g: commit sha or release), and we can create a link to the specific source file and line from the stack trace.

This is similar to what we did for JS ages ago, which [we suggested to disable on this blog post](https://blog.sentry.io/source-code-fetching/). But my specific suggestion is to fetch source when we know we're doing so for the **exact release/commit** so the path and line will never change.

This was added to .NET already which supports `source_link` so we can fetch code from GitHub and have source context for the standard library as well as popular OSS libs (like the Sentry SDK):

Related work:

Symbolic changes: https://github.com/getsentry/symbolic/pulls?q=sort%3Aupdated-desc+is%3Apr+author%3Avaind+is%3Aclosed
Prob more these 2 PRs: [1](https://github.com/getsentry/symbolic/pull/774), [2](https://github.com/getsentry/symbolic/pull/729)
And on symbolicator: https://github.com/getsentry/symbolicator/pulls?q=sort%3Aupdated-desc+is%3Apr+author%3Avaind+is%3Aclosed
LIke: [this](https://github.com/getsentry/symbolicator/pull/1103)

For example:

![Image](https://github.com/user-attachments/assets/ad9cec92-3c1b-4fd7-a135-4626aa397328)

LInks to: `https://github.com/JamesNK/Newtonsoft.Json/blob/4fba53a324c445f06ee08e45a015c346000a7ef2/Src/Newtonsoft.Json/JsonTextReader.cs#L1817`

While adding that link to the event, we also fetched source around it.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked Symbolic PRs 774 and 729 and Symbolicator PR 1103 to understand the existing source-linking work. Trace how Sentry handles stack traces with exact release or commit metadata. Done means events can link to the precise source file and line and fetch surrounding source when that exact VCS revision is known.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.