I am using OpenTelemetry to send traces to Jaeger int .net 6 by this code:
services.AddOpenTelemetry()
.ConfigureResource(configureResource)
.WithTracing(b =>
{
b.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddSqlClientInstrumentation()
.AddOtlpExporter(options => { options.Endpoint = new Uri("http://localhost:4317"); });
});
the problem is that all the logs using ILogger and all the health checks are sent to Jaeger. I want to ingnore them.
AddAspNetCoreInstrumentation
has an overload with options. You can configure aFilter
option to filter undesired requests:Similarly to AspNetCore instrumentation, the HttpClientInstrumentation has the
FilterHttpRequestMessage
to filter the outgoing requests:To stop sending logs, you need to remove the OpenTelemetry logging provider from the
Program.cs
file.Depending on the format of your
Program
class, it may look like thisor this