After switching from Azure TelemetryClient to OpenTelemetry we are seeing a tonne of CustomMetrics in Application Insights, so many in fact that we fill up our quote in less than one hour.
Looking inside Application Insights > Logs, I can see this: https://imgur.com/a/afu4aCM that shows at least 25 entries all in the same millisecond. So I would like to start by filtering out these logs, but being new to OpenTelemetry I am struggling with the documentation.
The application running is an asp.net core website and our OpenTelemetry configuration is quite basic:
public static void RegisterOpenTelemetry(this IServiceCollection service, IConfiguration configuration)
{
service.AddOpenTelemetry()
.UseAzureMonitor(options =>
{
options.ConnectionString = configuration["ApplicationInsights:ConnectionString"];
options.EnableLiveMetrics = true;
})
.WithTracing(x =>
{
x.AddSqlClientInstrumentation(options =>
{
options.SetDbStatementForText = true;
options.RecordException = true;
});
})
.WithMetrics(x =>
{
x.AddSqlClientInstrumentation();
});
service.Configure<AspNetCoreTraceInstrumentationOptions>(options =>
{
options.RecordException = true;
});
}
tl;dr: If I want to filter away all the 'http.client_open_connections', how can I do that?
Thanks in advance
The following should do the trick!
.WithMetrics(x =>
{
x.AddView(instrumentName: "http.client_open_connections", MetricStreamConfiguration.Drop)
x.AddSqlClientInstrumentation();
});