Skip to content

Commit

Permalink
hangfire cron monitor (#262)
Browse files Browse the repository at this point in the history
* hangfire cron monitor

* version
  • Loading branch information
bruno-garcia authored Mar 15, 2024
1 parent 27e7677 commit c3db6a2
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageVersion Include="RabbitMQ.Client" Version="6.8.1" />
<PackageVersion Include="Sentry" Version="$(SentryVersion)" />
<PackageVersion Include="Sentry.AspNetCore" Version="$(SentryVersion)" />
<PackageVersion Include="Sentry.Hangfire" Version="$(SentryVersion)" />
<PackageVersion Include="Sentry.Serilog" Version="$(SentryVersion)" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageVersion Include="Serilog.Enrichers.Environment" Version="3.0.0-dev-00806" />
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<SentryVersion>4.0.0</SentryVersion>
<SentryVersion>4.2.1</SentryVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
3 changes: 2 additions & 1 deletion src/NuGetTrends.Scheduler/DailyDownloadPackageIdPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Npgsql;
using NuGetTrends.Data;
using RabbitMQ.Client;
using Sentry;
using Sentry.Hangfire;

namespace NuGetTrends.Scheduler;

Expand All @@ -16,6 +16,7 @@ public class DailyDownloadPackageIdPublisher(
IHub hub,
ILogger<DailyDownloadPackageIdPublisher> logger)
{
[SentryMonitorSlug("DailyDownloadPackageIdPublisher.Import")]
public async Task Import(IJobCancellationToken token)
{
using var _ = hub.PushScope();
Expand Down
2 changes: 2 additions & 0 deletions src/NuGetTrends.Scheduler/NuGetCatalogImporter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Hangfire;
using NuGet.Protocol.Catalog;
using Sentry;
using Sentry.Hangfire;

namespace NuGetTrends.Scheduler;

Expand All @@ -12,6 +13,7 @@ public class NuGetCatalogImporter(
IHub hub,
ILoggerFactory loggerFactory)
{
[SentryMonitorSlug("NuGetCatalogImporter.Import")]
public async Task Import(IJobCancellationToken token)
{
using var _ = hub.PushScope();
Expand Down
1 change: 1 addition & 0 deletions src/NuGetTrends.Scheduler/NuGetTrends.Scheduler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<PackageReference Include="Hangfire.AspNetCore" />
<PackageReference Include="Hangfire.MemoryStorage" />
<PackageReference Include="Sentry.AspNetCore" />
<PackageReference Include="Sentry.Hangfire" />
<PackageReference Include="Sentry.Serilog" />
<PackageReference Include="Serilog.AspNetCore" />
<PackageReference Include="Serilog.Settings.Configuration" />
Expand Down
3 changes: 2 additions & 1 deletion src/NuGetTrends.Scheduler/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public void ConfigureServices(IServiceCollection services)
// TODO: Use Postgres storage instead:
// Install: Hangfire.PostgreSql
// Configure: config.UsePostgreSqlStorage(Configuration.GetConnectionString("HangfireConnection")
services.AddHangfire(config => config.UseStorage(new MemoryStorage()));
services.AddHangfire(config => config.UseStorage(new MemoryStorage()))
.AddSentry();
services.AddHangfireServer();

services.AddHttpClient("nuget"); // TODO: typed client? will be shared across all jobs
Expand Down

0 comments on commit c3db6a2

Please sign in to comment.