-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonitoringExtension.cs
More file actions
24 lines (21 loc) · 858 Bytes
/
Copy pathMonitoringExtension.cs
File metadata and controls
24 lines (21 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
namespace Comanda.Payments.WebApi.Extensions;
public static class MonitoringExtension
{
public static void AddMonitoring(this WebApplicationBuilder builder)
{
// prevents sentry from being initialized in non-production/non-development environments (e.g., testing)
if (!builder.Environment.IsDevelopment() && !builder.Environment.IsProduction())
return;
var settings = builder.Services
.BuildServiceProvider()
.GetRequiredService<ISettings>();
// https://docs.sentry.io/platforms/dotnet/
builder.WebHost.UseSentry(options =>
{
options.Dsn = settings.Observability.SentryDsn;
options.Environment = builder.Environment.EnvironmentName;
options.TracesSampleRate = 1.0;
options.EnableLogs = true;
});
}
}