Set Up Profiling
Rust Profiling is currently in alpha. Alpha features are still in-progress and may have bugs. We recognize the irony.
With profiling, Sentry allows you to collect and analyze performance profiles from real user devices in production to give you a complete picture of how your application performs in a variety of environments.
Enable Performance Monitoring
Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK:
sentry::init((
"https://examplePublicKey@o0.ingest.sentry.io/0",
sentry::ClientOptions {
release: sentry::release_name!(),
traces_sample_rate: 1.0,
..Default::default()
},
));
Check out the performance setup documentation for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured.
Enable Profiling
Rust Profiling alpha is available starting in SDK version 0.29.0
.
In order to use Profiling, you first need to enable the profiling
feature in the sentry
dependency inside the project Cargo.toml
:
[dependencies]
sentry = { version = "0.31.3", features = ["profiling"] }
Once you've completed the step above, you can proceed by enabling it in the SDK:
sentry::init((
"https://examplePublicKey@o0.ingest.sentry.io/0",
sentry::ClientOptions {
release: sentry::release_name!(),
traces_sample_rate: 1.0,
enable_profiling: true,
profiles_sample_rate: 1.0,
..Default::default()
},
));
The profiles_sample_rate
setting is relative to the traces_sample_rate
setting.
Troubleshooting
If you don't see any profiling data in sentry.io, you can try the following:
- Ensure that performance monitoring is enabled.
- Ensure that the automatic instrumentation is sending performance data to Sentry by going to the Performance page in sentry.io.
- If the automatic instrumentation is not sending performance data, try using custom instrumentation.
- Enable debug mode in the SDK and check the logs.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
- Package:
- cargo:sentry
- Version:
- 0.31.3
- Repository:
- https://github.com/getsentry/sentry-rust