DatadogStatsD 0.2.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package DatadogStatsD --version 0.2.5
NuGet\Install-Package DatadogStatsD -Version 0.2.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DatadogStatsD" Version="0.2.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DatadogStatsD --version 0.2.5
#r "nuget: DatadogStatsD, 0.2.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DatadogStatsD as a Cake Addin
#addin nuget:?package=DatadogStatsD&version=0.2.5

// Install DatadogStatsD as a Cake Tool
#tool nuget:?package=DatadogStatsD&version=0.2.5

DatadogStatsD

Full featured DogStatsD client:

Installation

DatadogStatsD targets both .NET Standard 2.0 & 2.1.

dotnet add package DatadogStatsD

Examples

await using var dogStatsD = new DogStatsD();

using var requests = dogStatsD.CreateCount("requests", new[] { "environment:dev" });
requests.Increment();
requests.Decrement();

var latency = dogStatsD.CreateHistogram("latency", sampleRate: 0.5);
latency.Sample(5.423);
latency.Sample(1.27);

using var threads = dogStatsD.CreateGauge("threads", () => Process.GetCurrentProcess().Threads.Count);

dogStasD.RaiseEvent(AlertType.Info, "Bad thing happened", "This happened");
dogStasD.SendServiceCheck("is_connected", CheckStatus.Ok);

See DogStatsDConfiguration.cs to configure the client.

Benchmark

Benchmark comparing performance of this library (DatadogStatsD), when sending 10000 metrics, with neuecc/DatadogSharp (DatadogSharp) and DataDog/dogstatsd-csharp-client (StatsDClient). Sources can be found in DatadogStatsD.Benchmark.

Count & Gauge

Method Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
DatadogStatsD 55.41 us 0.273 us 0.242 us - - - -
DatadogSharp 140,563.34 us 1,540.997 us 1,441.449 us 1750.0000 - - 5599762 B
StatsDClient 9,535.01 us 187.826 us 348.147 us 1671.8750 531.2500 109.3750 6089620 B

This library aggregates for 10 seconds (DogStatsD flush interval) counts and gauges, so for 10000 increments, one packet is sent, hence the ~0 bytes allocated.

Histogram, Set, Distribution

Method Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
DatadogStatsD 5.024 ms 0.0657 ms 0.0615 ms - - - 1.18 KB
DatadogSharp 140.095 ms 0.9445 ms 0.8835 ms 1750.0000 - - 5468.24 KB
StatsDClient 9.951 ms 0.1976 ms 0.4658 ms 1671.8750 515.6250 109.3750 5945.63 KB

For those metrics, the library lets DogStatsD agent do the aggregation, so with a sample rate of 1.0, each call to Histogram.Update will be sent to the agent.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0 222,369 10/26/2020
0.2.5 514 10/8/2020
0.2.4 499 7/26/2020
0.2.3 521 6/18/2020
0.2.2 422 6/14/2020
0.2.1 385 6/11/2020
0.2.0 387 6/10/2020
0.1.3 444 4/28/2020
0.1.2 660 3/30/2020
0.1.1 486 3/20/2020
0.1.0 493 3/20/2020