我需要保留所有遥测,因为我们将其用于分析。
根据this article,我可以运行以下Google Analytics查询来确定抽样率:
requests
| where timestamp > ago(1d)
| summarize 100/avg(itemCount) by bin(timestamp, 1h)
| render areachart
结果显示有一些严重抽样,特别是在白天只保留了大约十分之一的项目:
让我感到困惑的是Azure Portal阻止采样设置为100%:
也许这只反映了摄取采样?服务器上仍然可以进行自适应采样。
如何使用Application Insights的ASP.NET核心库完全禁用采样?(即Microsoft.ApplicationInsights.AspNetCore 1.0.2)
目前,这是我能找到的唯一配置,并且没有任何取样:
var appInsightsConfiguration = new ConfigurationBuilder()
.AddApplicationInsightsSettings(
developerMode: false,
instrumentationKey: Configuration["ApplicationInsights:InstrumentationKey"])
.Build();
services.AddApplicationInsightsTelemetry(appInsightsConfiguration);
答案 0 :(得分:8)
您可以使用ApplicationInsightsServiceOptions类禁用采样。
用法示例:
innerHTML
在Application Insights ASP.NET Core Github documentation page中查看有关抽样的详细信息。
希望这有帮助,
阿萨夫