A C# client to interface with Etsy's excellent statsd server.
Install the client via NuGet with the StatsdClient package.
##Usage
At app startup, configure the Metrics class (other options are documented on MetricsConfig):
Metrics.Configure(new MetricsConfig
{
StatsdServerName = "hostname",
Prefix = "myApp.prod"
});Then start measuring all the things!
Metrics.Counter("stat-name");
Metrics.Time(() => myMethod(), "stat-name"));
Metrics.GaugeAbsolute("gauge-name", 35);
Metrics.GaugeDelta("gauge-name", -5);
Metrics.Set("something-special", "3");You can also time with the disposable overload:
using (Metrics.StartTimer("stat-name"))
{
// Lots of code here
}Including functions that return a value:
var result = Metrics.Time(() => GetResult(), "stat-name");##Development
- Please have a chat about any big features before submitting PR's
- NuGet is packaged as an artefact on AppVeyor above. Grab that
*.nupkgand upload it to NuGet.org - Change major/minor versions in
appveyor.yml