Set Up Profiling

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 Profiling

To enable profiling, set the ProfilesSampleRate. Additionally, for all platforms except iOS/Mac Catalyst, you need to add a dependency on the Sentry.Profiling NuGet package.

Copied
dotnet add package Sentry.Profiling --prerelease

Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK, set the TracesSampleRate option to the desired value.

Copied
SentrySdk.Init(options =>
{
    // ... usual setup options omitted for clarity (see Getting Started) ...

    // Sample rate for your transactions, e.g. value 0.1 means we want to report 10% of transactions.
    // We recommend adjusting this value in production.
    options.TracesSampleRate = 1.0;

    // Sample rate for profiling, applied on top of othe TracesSampleRate,
    // e.g. 0.2 means we want to profile 20 % of the captured transactions.
    // We recommend adjusting this value in production.
    options.ProfilesSampleRate = 1.0;
});

Check out the performance setup documentation for more detailed information on how to configure sampling. Setting the traces sample rate to 1.0 means all transactions will be captured. Setting the profiles sample rate to 1.0 means all captured transactions will be profiled.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").