Externalize Windows Performance Counters

The Windows Performance Counters feature is in the process of being removed from the NServiceBus NuGet package. It is now available as a separate NuGet package named NServiceBus.Metrics.PerformanceCounters. The new package should be used to write to performance counters when using NServiceBus Versions 6.2 and above.

The Performance Counters APIs in the NServiceBus NuGet package have been marked as obsolete with warning and can still be used by suppressing the CS0618 warning.

Changed APIs

The NServiceBus Performance Counter APIs have been marked as obsolete and have one-for-one equivalents in the new NServiceBus.Metrics.PerformanceCounters package.

Enabling Critical Time Counter

1.x NServiceBus.Metrics.PerformanceCounters
var performanceCounters = endpointConfiguration.EnableWindowsPerformanceCounters();
6.x NServiceBus
endpointConfiguration.EnableCriticalTimePerformanceCounter();

Enabling SLA Counter

1.x NServiceBus.Metrics.PerformanceCounters
var performanceCounters = endpointConfiguration.EnableWindowsPerformanceCounters();
performanceCounters.EnableSLAPerformanceCounters(TimeSpan.FromMinutes(3));
6.x NServiceBus
endpointConfiguration.EnableSLAPerformanceCounter(TimeSpan.FromMinutes(3));

Compatibility

The NServiceBus.Metrics.PerformanceCounters package is fully compatible with endpoints that use NServiceBus package's Performance Counters functionality.

Related Articles


Last modified