getsentry / sentry-docs

Sentry's documentation (and tools to build it)
https://docs.sentry.io
Other
332 stars 1.46k forks source link

Document how to setup source context in Rust #9625

Open szokeasaurusrex opened 7 months ago

szokeasaurusrex commented 7 months ago

Core or SDK?

Platform/SDK

Which part? Which one?

Rust SDK

Description

How to correctly upload Rust debug files to obtain source context for errors in Sentry

Suggested Solution

Add a page to document how to configure the Cargo.toml file to obtain debug files in the correct format, and explain how to use the Sentry CLI to upload debug files with sources.

Specifically, the Cargo.toml needs to contain the following:

# For source context on errors emitted from development builds
[profile.dev]
split-debuginfo = "packed"

# For source context on errors emitted from release builds
[profile.release]
split-debuginfo = "packed"

After configuring the Cargo.toml per the above, users need to build the code with cargo build (or cargo build --release, as desired).

Once compiled, the debug files and source context can be uploaded with:

sentry-cli debug-files upload --include-sources /path/to/project
Roshan-R commented 2 months ago

Thanks! This fixed the issue for me. It should definitely be added to the documentation