...
/Implementing Custom Telemetry Capture
Implementing Custom Telemetry Capture
Learn how to implement custom telemetry capture in a minimal API project using System.Diagnostics.DiagnosticSource and OpenTelemetry.
We'll cover the following...
We’ll create a simple example that will allow us to not only see how the OpenTelemetry SDK works but also how Meter
objects can be used to house many different counters and data points:
Setting up the project
We create a new minimal API project in Visual Studio or with the
dotnet
command line. Here’s the screenshot for the new minimal API project:
Here’s the screenshot for the dotnet
command-line interface:
We have to be sure to uncheck the “Use controllers” checkbox to use minimal APIs if using the new project dialog from Visual Studio.
We add a NuGet reference to
System.Diagnostics.DiagnosticSource
andOpenTelemetry.Instrumentation.EventCount
...