DatadogStatsD 0.2.4

High Performance DogStatsD Client

Install-Package DatadogStatsD -Version 0.2.4
dotnet add package DatadogStatsD --version 0.2.4
<PackageReference Include="DatadogStatsD" Version="0.2.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DatadogStatsD --version 0.2.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

DatadogStatsD

Full featured DogStatsD client:

Installation

DatadogStatsD targets .NET Standard 2.1.

dotnet add package DatadogStatsD

Examples

await using var dogStatsD = new DogStatsD();

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

var latency = dogStatsD.CreateHistogram("latency", sampleRate: 0.5);
exampleMetric2.Sample(5.423);
exampleMetric2.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.

DatadogStatsD

Full featured DogStatsD client:

Installation

DatadogStatsD targets .NET Standard 2.1.

dotnet add package DatadogStatsD

Examples

await using var dogStatsD = new DogStatsD();

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

var latency = dogStatsD.CreateHistogram("latency", sampleRate: 0.5);
exampleMetric2.Sample(5.423);
exampleMetric2.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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.2.4 131 7/26/2020
0.2.3 135 6/18/2020
0.2.2 80 6/14/2020
0.2.1 33 6/11/2020
0.2.0 56 6/10/2020
0.1.3 68 4/28/2020
0.1.2 285 3/30/2020
0.1.1 143 3/20/2020
0.1.0 142 3/20/2020