我想禁用对使用应用程序洞察力的 Azure 函数的采样。我已经遵循了这些文档,但仍然启用了采样。
在 Application Insights 中,我使用此查询来确定采样率:
dependencies
| where timestamp > ago(1d)
| summarize RetainedPercentage = 100/avg(itemCount) by bin(timestamp, 1h)
| order by timestamp desc
这是我的 host.json 文件:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"LogLevel": {
"default": "Information"
},
"samplingSettings": {
"isEnabled": false
}
}
}
}
我也试过在代码中禁用采样:
var aiOptions = new ApplicationInsightsServiceOptions
{
EnableAdaptiveSampling = false,
InstrumentationKey = configuration.GetValue<string>("Telemetry:AppInsightsInstrumentationKey")
};
services.AddApplicationInsightsTelemetry(aiOptions);