feat: add preprod observability foundation
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
using Socialize.Api.Infrastructure.Observability;
|
||||
|
||||
namespace Socialize.Api.Modules.CalendarIntegrations.Services;
|
||||
|
||||
internal sealed class CalendarImportBackgroundService(
|
||||
IServiceScopeFactory scopeFactory,
|
||||
SocializeMetrics metrics,
|
||||
ILogger<CalendarImportBackgroundService> logger)
|
||||
: BackgroundService
|
||||
{
|
||||
@@ -22,6 +25,7 @@ internal sealed class CalendarImportBackgroundService(
|
||||
using IServiceScope scope = scopeFactory.CreateScope();
|
||||
CalendarImportSyncService syncService = scope.ServiceProvider.GetRequiredService<CalendarImportSyncService>();
|
||||
await syncService.RefreshDueSourcesAsync(stoppingToken);
|
||||
metrics.RecordBackgroundJobRun(nameof(CalendarImportBackgroundService), true);
|
||||
}
|
||||
catch (OperationCanceledException ex) when (stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
@@ -30,6 +34,7 @@ internal sealed class CalendarImportBackgroundService(
|
||||
#pragma warning disable CA1031 // Background service should log and continue after unexpected sync failures.
|
||||
catch (Exception ex)
|
||||
{
|
||||
metrics.RecordBackgroundJobRun(nameof(CalendarImportBackgroundService), false);
|
||||
logger.LogError(ex, "Calendar import background sync failed.");
|
||||
}
|
||||
#pragma warning restore CA1031
|
||||
|
||||
Reference in New Issue
Block a user