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.
Using performance counters - 图1

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):

  1. hangfire-perf ipc

To uninstall performance counters, use the upc command:

  1. 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:

  1. using Hangfire.PerformanceCounters;
  2.  
  3. PerformanceCounters.Initialize("unique-app-id");

Initialization logic is much easier within your OWIN Startup class:

  1. using Hangfire.PerformanceCounters;
  2.  
  3. public void Configure(IAppBuilder app)
  4. {
  5. app.UseHangfirePerformanceCounters();
  6. }

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.

原文:

http://docs.hangfire.io/en/latest/deployment-to-production/performance-counters.html