This library instruments XO.Console.Cli applications for OpenTelemetry tracing.
> dotnet add package XO.Console.Cli.Instrumentation
If your project does not already reference OpenTelemetry, add that, too.
> dotnet add package OpenTelemetry > dotnet add package OpenTelemetry.Extensions.Hosting
return await Host.CreateDefaultBuilder(args)
.ConfigureServices(static (context, services) => {
services.AddOpenTelemetry()
.WithTracing(static (tracerProviderBuilder) => {
// add the XO.Console.Cli activity source to the tracer configuration
tracerProviderBuilder.AddCommandAppInstrumentation();
});
})
.RunCommandAppAsync(args);