从 Azure TelemetryClient 切换到 OpenTelemetry 后,我们在 Application Insights 中看到大量 CustomMetrics,事实上,数量如此之多,以至于我们在不到一小时的时间内就填满了报价。
查看 Application Insights > Logs,我可以看到:https://imgur.com/a/afu4aCM,它在同一毫秒内显示至少 25 个条目。因此,我想先过滤掉这些日志,但由于对 OpenTelemetry 还不熟悉,因此很难理解文档。
运行的应用程序是一个 asp.net 核心网站,我们的 OpenTelemetry 配置非常简单:
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:如果我想过滤掉所有的“http.client_open_connections”,我该怎么做?
提前致谢