DatadogStatsD 0.2.0
See the version list below for details.
dotnet add package DatadogStatsD --version 0.2.0
NuGet\Install-Package DatadogStatsD -Version 0.2.0
<PackageReference Include="DatadogStatsD" Version="0.2.0" />
paket add DatadogStatsD --version 0.2.0
#r "nuget: DatadogStatsD, 0.2.0"
// Install DatadogStatsD as a Cake Addin #addin nuget:?package=DatadogStatsD&version=0.2.0 // Install DatadogStatsD as a Cake Tool #tool nuget:?package=DatadogStatsD&version=0.2.0
DatadogStatsD
Full featured DogStatsD client:
- Count, Histogram, Gauge, Distribution, Set
- Events
- Service Checks
- UDP or UDS transport
- Performance - Metrics are aggregated and the submissions are batched
- Back pressure - Transport drops new metrics when it's falling behind
- Telemetry - Metrics to monitor communication between the agent and this client
Installation
DatadogStatsD targets .NET Standard 2.1.
dotnet add package DatadogStatsD
Examples
using var dogStatsD = new DogStatsD();
using var requests = dogStatsD.CreateCount("requests", new[] { "environment:dev" });
exampleMetric.Increment();
exampleMetric.Decrement();
using var latency = dogStatsD.CreateHistogram("latency", sampleRate: 0.5);
exampleMetric2.Record(5.423);
exampleMetric2.Record(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 with neuecc/DatadogSharp and DataDog/dogstatsd-csharp-client. Sources can be found in DatadogStatsD.Benchmark.
Count & Gauge
Method | Op | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
DatadogStatsD | 1000 | 8.480 us | 0.1635 us | 0.3554 us | - | - | - | - |
DatadogSharp | 1000 | 8,640.205 us | 171.6157 us | 390.8558 us | 343.7500 | - | - | 558880 B |
StatsDClient | 1000 | 9,928.695 us | 168.0484 us | 206.3785 us | 578.1250 | - | - | 912021 B |
DatadogStatsD | 10000 | 86.608 us | 1.7011 us | 2.6982 us | - | - | - | - |
DatadogSharp | 10000 | 84,551.941 us | 1,679.0799 us | 3,112.2822 us | 3428.5714 | - | - | 5598880 B |
StatsDClient | 10000 | 102,578.512 us | 1,974.8266 us | 4,416.9827 us | 5800.0000 | - | - | 9192000 B |
DatadogStatsD | 100000 | 862.448 us | 17.0070 us | 35.5000 us | - | - | - | - |
DatadogSharp | 100000 | 852,460.918 us | 16,706.6878 us | 29,260.4160 us | 35000.0000 | - | - | 56000000 B |
StatsDClient | 100000 | 1,001,979.915 us | 20,012.3158 us | 28,054.4718 us | 58000.0000 | - | - | 91992000 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 | Op | Mean | Error | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
DatadogStatsD | 1000 | 607.0 us | 11.48 us | 18.87 us | - | - | - | 384 B |
DatadogSharp | 1000 | 8,485.5 us | 162.87 us | 167.26 us | 343.7500 | - | - | 559013 B |
StatsDClient | 1000 | 10,053.5 us | 200.77 us | 396.29 us | 578.1250 | - | - | 912000 B |
DatadogStatsD | 10000 | 5,955.4 us | 118.61 us | 170.11 us | - | - | - | 3196 B |
DatadogSharp | 10000 | 87,439.0 us | 1,722.20 us | 3,670.14 us | 3500.0000 | - | - | 5599101 B |
StatsDClient | 10000 | 104,099.7 us | 2,063.75 us | 3,504.41 us | 5800.0000 | - | - | 9192000 B |
DatadogStatsD | 100000 | 60,332.3 us | 1,202.28 us | 3,291.21 us | - | - | - | 23940 B |
DatadogSharp | 100000 | 867,484.8 us | 17,075.68 us | 22,203.21 us | 35000.0000 | - | - | 56000000 B |
StatsDClient | 100000 | 972,766.1 us | 19,108.68 us | 28,600.97 us | 58000.0000 | - | - | 91993400 B |
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 | Versions 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- System.Buffers (>= 4.5.0)
- System.Threading.Channels (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.