Metrics.NET
13 Apr 2014 | net | comments | editFor the past couple of weeks I've been working on a new pet project, a .NET port of Coda Hale's Metrics library.
The Metrics.NET library provides a way of instrumenting applications with custom metrics (timers, historams, counters etc) that can be reported in various ways and can provide insights on what is happening inside a running application.
The library is published on NuGet can be installed with the following command:
Install-Package Metrics.NET
Supported runtimes: .NET 4.5.1, .NET 4.5, .NET 4.0, Mono 3.4.0 ( tested on OsX ).
The API of the library might change until a 1.X version will be made available.
Documentation:
Quick Usage Sample
public class SampleMetrics
{
private readonly Timer timer =
Metric.Timer("Requests", SamplingType.FavourRecent, Unit.Requests);
public void Request(int i)
{
// measure until disposed
using (this.timer.NewContext())
{
// do some work
}
}
}
For more information on the library see the GitHub repository and the GitHub Wiki.