Ext.Hangfire.Prometheus
1.0.5
dotnet add package Ext.Hangfire.Prometheus --version 1.0.5
NuGet\Install-Package Ext.Hangfire.Prometheus -Version 1.0.5
<PackageReference Include="Ext.Hangfire.Prometheus" Version="1.0.5" />
<PackageVersion Include="Ext.Hangfire.Prometheus" Version="1.0.5" />
<PackageReference Include="Ext.Hangfire.Prometheus" />
paket add Ext.Hangfire.Prometheus --version 1.0.5
#r "nuget: Ext.Hangfire.Prometheus, 1.0.5"
#:package Ext.Hangfire.Prometheus@1.0.5
#addin nuget:?package=Ext.Hangfire.Prometheus&version=1.0.5
#tool nuget:?package=Ext.Hangfire.Prometheus&version=1.0.5
Hangfire.Prometheus
Simple plugin for .NET Core applications to export Hangfire stats to Prometheus.
Initial Kudos
This plugin was extended based on Hangfire.Prometheus. All credits go to fiftyonefifty for the original work.
Description
The plugin uses the Hangfire JobStorage class to export metric "hangfire_job_count" using "state" label to indicate jobs in various states. The metrics are updated before every scrape. The states exported are:
- Failed
- Enqueued
- Scheduled
- Processing
- Succeeded
- Retry
Usage
Hangfire.Prometheus plugin is initialized in Configure() using UseHangfirePrometheusExporter() method. Hangfire job storage must already be initialized.
public void ConfigureServices(IServiceCollection services)
{
services.AddHangfire(...);
}
public void Configure(IApplicationBuilder app)
{
app.UsePrometheusHangfireExporter();
app.UseMetricServer();
app.UseHangfireDashboard();
app.UseHangfireServer();
}
Settings
The following settings are available for this plugin using Hangfire.Prometheus.HangfirePrometheusSettings class:
| Setting Name | Type | Default Setting | Description |
|---|---|---|---|
| CollectorRegistry | Prometheus.CollectorRegistry | Metrics.DefaultRegistry | Prometheus CollectorRegistry to use. |
| FailScrapeOnException | Boolean | true | Controls whether to fail the scrape if there is an exception during Hangifre statistics collection. |
An instance of HangfirePrometheusSettings class can be passed to UsePrometheusHangfireExporter() to use settings other than defaults:
public void Configure(IApplicationBuilder app)
{
CollectionRegistry myRegistry = Metrics.NewCustomRegistry();
app.UsePrometheusHangfireExporter(new HangfirePrometheusSettings { CollectorRegistry = myRegistry });
app.UseMetricServer(...);
}
Simultaneous Scrapes
Simultaneous scrapes proceed at the same time. Care should be taken when setting the scrape interval period to minimize simultaneous scrapes.
Multiple Servers
This plugin uses Hangfire job storage to retrieve job statistics. If multiple Hangfire servers are using the same job storage only a single instance should be exporting Hangfire metrics or only a single instance must be scraped.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Hangfire.Core (>= 1.8.20)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- prometheus-net (>= 8.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.