Skip to content
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

Server-side source context #177

Open
4 tasks
rhcarvalho opened this issue Mar 4, 2020 · 6 comments
Open
4 tasks

Server-side source context #177

rhcarvalho opened this issue Mar 4, 2020 · 6 comments

Comments

@rhcarvalho
Copy link
Contributor

rhcarvalho commented Mar 4, 2020

Add support for serve-side source context using source bundles.
https://docs.sentry.io/workflow/debug-files/#source-context

Overview

At the moment, the Contextify Frames Integration in the SDK automatically grabs context lines when those are available nearby a running binary.

We document how this can be used when deploying to a serverless platform.

While that integration can be used in certain contexts, it won't help when you (have to) distribute binaries without source code available.

The solution is to add source context on the Sentry server, and that is done by uploading source bundles after building a program.


Development notes

Creating source bundles

Use sentry-cli to generate a zip archive with source files and a manifest:

  1. Bump symbolic dependency in Cargo.toml to at least getsentry/symbolic@8f9a017
    (edit: not needed anymore, bumped upstream).

  2. Run

    cargo run -- difutil bundle-sources /path/to/binary...
    
  3. Inspect manifest.json in source archive

    unzip -p /path/to/file.src.zip manifest.json | jq -C | less
    

    code_id is the gnu.build-id.
    debug_id is a transformation from code_id if it exists, or otherwise a hash of the text section.

    See https://github.com/getsentry/symbolic/blob/@{2020.03.03}/debuginfo/src/elf.rs#L92.


References:


TODO

On the SDK, we need:

@iagomelanias
Copy link

iagomelanias commented Mar 30, 2020

This feature would be extremely helpful, especially if /go/pk/mod was supported. 🚀

@peterldowns
Copy link

Is this work scheduled / is there going to be some other way to get the source context in stacktraces without shipping the source alongside built binaries? We love Sentry and love that feature, but we don't want to start shipping source code in our containers that hold our golang web servers just to get slightly more usable stacktraces. I know that "Stack trace linking" via Github integration is now in beta, and that for Javascript there's a way to upload source maps as part of releases, and when I squint that looks like the same thing that we'd want to do here, but whatever the implementation method I'd really like to see the surrounding code inside stacktraces on error pages.

@rhcarvalho
Copy link
Contributor Author

Sharing here that another viable way to get source code context in stack traces is to use Sentry's GitHub/Gitlab integrations:

https://docs.sentry.io/product/integrations/github/#stack-trace-linking
https://docs.sentry.io/product/integrations/gitlab/#stack-trace-linking

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@armenzg
Copy link
Member

armenzg commented Feb 16, 2023

Hey folks, is #44525 something you could take on as part of this initiative? I'm happy to guide

@cleptric
Copy link
Member

@armenzg I assume we could do something with our GitHub integration.

Sample error from our profiling ingestion service https://sentry.sentry.io/issues/3908326163/ (internal link). All paths are preserved in the stack trace, so we could fetch the source context with that from a repo.

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

No branches or pull requests

6 participants