Send Custom Events From Your Microsoft .NET Application | Datadog

Send custom events from your Microsoft .NET application

Author Remi Hakim

Published: June 10, 2015

Two years ago, we introduced our Datadog .NET StatsD port, DogStatsD, which allows you to track the performances of your C# applications by sending custom metrics to Datadog, where they can be graphed and analyzed in real time.To learn more about StatsD, you can read this blog.

MIcrosoft .NET Custom Events Ingestion

Events can now be sent straight from Microsoft .NET to DogStatsD. This allows you to correlate custom events occurring in your environment with your application metrics. For example, you can see if certain events occur at the same time as spikes occur in certain Microsoft .NET application metrics. To send an event from your C# applications just add the following line to your code:

// Post a simple message
DogStatsd.Event("Daily script just finished", "It ran in 2h52m.");
// Send an error event
DogStatsd.Event("Unauthorized login detected", "This should never happen", alertType: "error", tags: new[] { "urgent", "security" });

This snippet will yield events similar to the ones below:

Microsoft .Net Blog Events

Getting Started

In order to start using the DogStatsD C# client in your application you’ll need the following:

Once you have these prerequisites, open the project you want to monitor in Visual Studio. Then, click on the Tools menu, hover over Library Package Manager, and select Package Manager Console.

Microsoft .Net Blog Package

The Package Manager Console will now be displayed. Execute the following command in the console:

Install-Package DogStatsD-CSharp-Client

You are now ready to send events from your C# Application!

More detailed documentation for the .NET library can be found on the GitHub repository.