Using Performance Counters

Pro Only

This feature is a part of Hangfire Pro package set

Performance Counters is a standard way to measure different application metrics on a Windows platform. This package enables Hangfire to publish performance counters so you can track them using different tools, including Performance Monitor, Nagios, New Relic and others.

../_images/perfmon.png

Installation

Before configuring Hangfire and starting to publish performance counters, you need to add them to every machine you use by running hangfire-perf.exe program with the ipc argument (for both install and update actions):

hangfire-perf ipc

To uninstall performance counters, use the upc command:

hangfire-perf upc

Configuration

Performance counters are exposed through the Hangfire.Pro.PerformanceCounters package. After adding it to your project, you need only to initialize them by invoking the following method:

using Hangfire.PerformanceCounters;

PerformanceCounters.Initialize("unique-app-id");

Initialization logic is much easier within your OWIN Startup class:

using Hangfire.PerformanceCounters;

public void Configure(IAppBuilder app)
{
    app.UseHangfirePerformanceCounters();
}

Membership Configuration

Also, ensure your IIS/ASP.NET user is a member of the “Performance Monitor Users” group.

Performance counters

Here is the list of performance counters currently exposed:

  • Creation Process Executions

  • Creation Process Executions/Sec

  • Performance Process Executions

  • Performance Process Executions/Sec

  • Transitions to Succeeded State

  • Transitions to Succeeded State/Sec

  • Transitions to Failed State/Sec

Want more? Just open a GitHub Issue and describe what metric you want to see.