From 8e4a5ed4d8b23fc4667d9f2b2c4b721dbd1ca76b Mon Sep 17 00:00:00 2001 From: Alexandre Brandizzi Date: Thu, 3 Sep 2026 13:59:13 -0300 Subject: [PATCH] feat: add API Sentry tracing --- .env.example | 6 +++++- Api.SeaHavenIndustries/Api.SeaHavenIndustries.csproj | 1 + Api.SeaHavenIndustries/Program.cs | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index db65d8b..4a6f6d4 100644 --- a/.env.example +++ b/.env.example @@ -16,6 +16,11 @@ # uses the AWS SDK default credential chain (env AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY, # the shared profile/SSO, or the EC2/ECS instance role). Prefer an instance role in prod. +# --- Sentry error and transaction monitoring --- +# Leave the DSN blank to keep telemetry inactive. Set the environment per deployment. +SENTRY_DSN= +SENTRY_ENVIRONMENT=development + # --- SQL Server connection string (Api.SeaHavenIndustries + SeaHavenIndustries) --- ConnectionStrings__DefaultConnection=Server=;Initial Catalog=;User Id=;Password=;MultipleActiveResultSets=true @@ -44,4 +49,3 @@ Sync__Enabled=true # --- Legacy endpoint deprecation headers --- LegacyEndpoints__DeprecationEnabled=false LegacyEndpoints__SunsetDate=2026-12-31 - diff --git a/Api.SeaHavenIndustries/Api.SeaHavenIndustries.csproj b/Api.SeaHavenIndustries/Api.SeaHavenIndustries.csproj index 8364296..8ab50ee 100644 --- a/Api.SeaHavenIndustries/Api.SeaHavenIndustries.csproj +++ b/Api.SeaHavenIndustries/Api.SeaHavenIndustries.csproj @@ -15,6 +15,7 @@ all + diff --git a/Api.SeaHavenIndustries/Program.cs b/Api.SeaHavenIndustries/Program.cs index 16028f9..2c9f1b8 100644 --- a/Api.SeaHavenIndustries/Program.cs +++ b/Api.SeaHavenIndustries/Program.cs @@ -16,6 +16,13 @@ using SeaHaven.Services.Implementation; using SeaHaven.Services.Interfaces; var builder = WebApplication.CreateBuilder(args); + +builder.WebHost.UseSentry(options => +{ + options.TracesSampleRate = 1.0; + options.SendDefaultPii = false; +}); + ConfigurationManager configuration = builder.Configuration; builder.Services.AddDbContext(options => options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));