Scaffold uses OpenTelemetry for distributed tracing and can be configured to send traces to an OpenTelemetry collector or directly to your backend of choice. Using an OpenTelemetry collector is recommended as it allows you to keep Scaffold abstracted away from your tracing backend.
For local development, Scaffold has been configured to send traces to an OpenTelemetry collector which then forwards them to a local Jaeger instance. You can view the traces at http://localhost:16686/search. It is also possible to view the traces in the local Grafana instance at http://localhost:3000.
For more details about using OpenTelemetry in .NET, please check out the OpenTelemetry .NET project.
To instrument your code with traces, you can use the OpenTelemetry .NET API or the native .NET Activity APIs. Using the native .NET Activity APIs is preferred.
An internal static ActivityProvider which wraps around some of the .NET Activity APIs has been provided in Scaffold to help you instrument the application layer. The following is an example of how to use it.
using (Activity? activity = ActivityProvider.StartActivity("ActivityName"))
{
// Perform activity here!
}