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.
AddAspNetCoreInstrumentationhas an overload with options. You can configure aFilteroption to filter undesired requests:Similarly to AspNetCore instrumentation, the HttpClientInstrumentation has the
FilterHttpRequestMessageto filter the outgoing requests:To stop sending logs, you need to remove the OpenTelemetry logging provider from the
Program.csfile.Depending on the format of your
Programclass, it may look like thisor this