feat(sentry): Добавил интеграцию Sentry для логирования и профилирования
All checks were successful
Create and publish a Docker image / Publish image (push) Successful in 1m47s

This commit is contained in:
2026-03-08 03:34:21 +03:00
parent f08d6af4c7
commit 9fd446fe04
3 changed files with 14 additions and 1 deletions

View File

@@ -82,6 +82,15 @@ if (!string.IsNullOrEmpty(configuration[AppConsts.TgChatIdEnv]) && !string.IsNul
});
#endregion
builder.WebHost.UseSentry(options =>
{
options.Dsn = configuration["Sentry:Dsn"] ?? "";
options.EnableLogs = true;
options.TracesSampleRate = 1.0;
options.ProfilesSampleRate = 1.0;
options.AddProfilingIntegration();
});
// Включаем MVC контроллеры
var mvcBuilder = builder.Services.AddControllers();
builder.Services.AddHttpClient("modeus", client =>
@@ -316,6 +325,7 @@ app.UseSwaggerUI();
app.UseStaticFiles();
app.UseRouting();
app.UseSentryTracing();
app.UseAuthentication();
app.UseAuthorization();

View File

@@ -14,7 +14,9 @@
<PackageReference Include="Microsoft.Identity.Web" Version="4.3.0" />
<PackageReference Include="prometheus-net.AspNetCore" Version="8.2.1"/>
<PackageReference Include="Quartz.AspNetCore" Version="3.15.1"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
<PackageReference Include="Sentry.AspNetCore" Version="6.1.0"/>
<PackageReference Include="Sentry.Profiling" Version="6.1.0"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6"/>
<PackageReference Include="X.Extensions.Logging.Telegram" Version="2.0.2"/>
</ItemGroup>

View File

@@ -17,6 +17,7 @@ services:
# - TOKEN=${TOKEN}
- AUTH_URL=${AUTH_URL}
- AUTH_API_KEY=${AUTH_API_KEY}
- Sentry:Dsn=${SENTRY_DSN:-}
volumes:
- data:/app/data
restart: always