Install the sentry .NET SDK:
dotnet add package Sentry
Initialize the SDK as early as possible (e.g., in Program.cs):
using Sentry;
SentrySdk.Init(options =>
{
options.Dsn = "YOUR_DSN";
options.TracesSampleRate = 0.01; // 1% of transactions
});
Verify your setup:
SentrySdk.CaptureMessage("Test GlitchTip error!");
await SentrySdk.FlushAsync(TimeSpan.FromSeconds(2)) before your application exits.TracesSampleRate to a low value in production to save disk space.