getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
37.58k stars 4.04k forks source link

Stack Trace Link doesn't work even with mapping #61730

Closed bruno-garcia closed 5 months ago

bruno-garcia commented 7 months ago

Here's a repro, can't get this to work: https://nugettrends.sentry.io/settings/integrations/github/162668/?tab=codeMappings

image

(issue) source path (pretty annoying I can't copy because tooltip moves away, and "Raw" stack trace doesn't include path. So I have to view the event as JSON to copy the file path):

image

Still no "Open on GitHub" shows up.

Not sure if it's related to, maybe UI specific limitation?

Since that's about source_link with System frames, and this is just pure Sentry Source Link with GitHub integration for InApp frames I imagine it might not be related at all.

Worth noting this is what the frame looks like in JSON:

{
"function": "async Task<IActionResult> PackageController.GetDownloadHistory(string id, CancellationToken cancellationToken, int months)",
"package": "NuGetTrends.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"filename": "PackageController.cs",
"abs_path": "[/home/runner/work/nuget-trends/nuget-trends/src/NuGetTrends.Web/PackageController.cs](https://us.sentry.io/home/runner/work/nuget-trends/nuget-trends/src/NuGetTrends.Web/PackageController.cs)",
"lineno": 38,
"colno": 9,
"pre_context": [
"    public async Task<IActionResult> GetDownloadHistory(",
"        [FromRoute] string id,",
"        CancellationToken cancellationToken,",
"        [FromQuery] int months = 3)",
"    {"
],
"context_line": "        if (! await context.PackageDownloads.",
"post_context": [
"                AnyAsync(p => p.PackageIdLowered.Equals(id, StringComparison.InvariantCultureIgnoreCase), cancellationToken))",
"        {",
"            return NotFound();",
"        }",
""
],
"in_app": true,
"data": {
"symbolicator_status": "symbolicated"
},
"instruction_addr": "0x37",
"addr_mode": "rel:2",
"function_id": "0x20"
},

Note that filename only contains a file name (no path). And the path (FQP) is on abs_path, this was something @malwilley noticed on slack:

"filename": "PackageController.cs",
"abs_path": "[/home/runner/work/nuget-trends/nuget-trends/src/NuGetTrends.Web/PackageController.cs]
bruno-garcia commented 5 months ago

Verified this works great! Just found that this came up back in 2021, good news for all C# devs out there: https://forum.sentry.io/t/source-code-links-for-c-code/15180