Statsd C# Client
Switch branches/tags
Nothing to show
Clone or download

Statsd Client

Build status NuGet Version

A .NET Standard compatible C# client to interface with Etsy's excellent statsd server.

Install the client via NuGet with the StatsdClient package.


At app startup, configure the Metrics class:

Metrics.Configure(new MetricsConfig
  StatsdServerName = "hostname",
  Prefix = ""

Start measuring all the things!

Metrics.Time(() => myMethod(), "timer-name");
var result = Metrics.Time(() => GetResult(), "timer-name");
var result = await Metrics.Time(async () => await myAsyncMethod(), "timer-name");
Metrics.GaugeAbsoluteValue("gauge-name", 35);
Metrics.GaugeDelta("gauge-name", -5);
Metrics.Set("something-special", "3");

using (Metrics.StartTimer("stat-name"))
  // Lots of code here

Advanced Features

To enable these, see the MetricsConfig class discussed above.

  • UseTcpProtocol: sends metrics to statsd via TCP. While supported, UDP is recommended in most cases. If you need TCP reliability, a relay service running locally on the server which you'd send UDP to, and it would relay via TCP, is advised.


See the Contributing guidelines.