Azure Application Insights-在高流量情况下不记录所有请求
似乎“Azure Application Insights”没有记录高流量环境中的所有请求 例如,当我们测试部署在“Azure Service Fabric”上的.Net Core2.1 Web API应用程序时,它有10000个30分钟的请求,可以通过KQL使用日期戳作为过滤器从“Azure Application Insights”检索所有请求的详细信息,没有问题 当我们在30分钟内将负载增加到100000个请求时,只有大约5-10%的请求记录在“Azure应用程序洞察”中 为什么“Azure Application Insights”会在高流量环境中错过摄取/录制,该环境每秒大约提供60个请求 需要额外的配置吗?(或)仅在一行代码下方接收Azure服务结构服务提供的请求的详细信息是不够的?请澄清 使用的SDK, 在Azure服务结构上用于摄取的代码Azure Application Insights-在高流量情况下不记录所有请求,azure,azure-service-fabric,azure-application-insights,azure-monitoring,telemetry,Azure,Azure Service Fabric,Azure Application Insights,Azure Monitoring,Telemetry,似乎“Azure Application Insights”没有记录高流量环境中的所有请求 例如,当我们测试部署在“Azure Service Fabric”上的.Net Core2.1 Web API应用程序时,它有10000个30分钟的请求,可以通过KQL使用日期戳作为过滤器从“Azure Application Insights”检索所有请求的详细信息,没有问题 当我们在30分钟内将负载增加到100000个请求时,只有大约5-10%的请求记录在“Azure应用程序洞察”中 为什么“Azur
return new WebHostBuilder().UseHttpSys()
.ConfigureServices(
services => services
.AddSingleton<StatelessServiceContext>(serviceContext)
.AddSingleton<ServiceFabricAppContext>(new ServiceFabricAppContext(){
NodeName = serviceContext.NodeContext.NodeName,
ServiceHostIP=serviceContext.NodeContext.IPAddressOrFQDN,
ServiceHostPort=FabricRuntime.GetActivationContext().GetEndpoints()[0].Port
} )
.AddSingleton<ITelemetryInitializer>((serviceProvider) => FabricTelemetryInitializerExtension.CreateFabricTelemetryInitializer(serviceContext))) // Azure Service Fabric Telemetry Initializer
.UseContentRoot(Directory.GetCurrentDirectory())
.UseApplicationInsights()
.UseStartup<Startup>()
.UseEnvironment(environment)
.UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)
.UseUrls(url)
.Build();
返回新的WebHostBuilder().UseHttpSys()
.配置服务(
服务=>服务
.AddSingleton(serviceContext)
.AddSingleton(新ServiceFabricAppContext(){
NodeName=serviceContext.NodeContext.NodeName,
ServiceHostIP=serviceContext.NodeContext.IPAddressOrFQDN,
ServiceHostPort=FabriRuntime.GetActivationContext().GetEndpoints()[0]。端口
} )
.AddSingleton((serviceProvider)=>FabricTelemetryInitializerExtension.CreateFabricTelemetryInitializer(serviceContext))//Azure服务结构遥测初始值设定项
.UseContentRoot(目录.GetCurrentDirectory())
.UseApplicationInsights()
.UseStartup()
.UseEnvironment(环境)
.UseServiceFabricIntegration(侦听器,ServiceFabricIntegrationOptions.None)
.useURL(url)
.Build();
带有项目计数的示例查询
未从Azure门户启用采样
您可以从代码中禁用自适应采样。注意:我没有使用不推荐的
.UseApplicationInsights()
(下面已删除),而是使用下面的.AddApplicationInsightsTelemetry
返回新的WebHostBuilder().UseHttpSys()
.配置服务(
服务=>服务
.AddSingleton(serviceContext)
.AddSingleton(新ServiceFabricAppContext(){
NodeName=serviceContext.NodeContext.NodeName,
ServiceHostIP=serviceContext.NodeContext.IPAddressOrFQDN,
ServiceHostPort=FabriRuntime.GetActivationContext().GetEndpoints()[0]。端口
} )
.AddSingleton((serviceProvider)=>FabricTelemetryInitializerExtension.CreateFabricTelemetryInitializer(serviceContext))//Azure服务结构遥测初始值设定项
.AddApplicationInsightsTelemetry(o=>
{
o、 EnableAdaptiveSampling=false;//禁用自适应采样
}))
.UseContentRoot(目录.GetCurrentDirectory())
.UseStartup()
.UseEnvironment(环境)
.UseServiceFabricIntegration(侦听器,ServiceFabricIntegrationOptions.None)
.useURL(url)
.Build();
注意:我必须添加nugetMicrosoft.ApplicationInsights.AspNetCore
警告:在流量非常大的情况下,禁用采样可能会导致节流和过多的网络流量。因此,您可能希望查看固定速率采样,而不是自适应采样。请参阅。这可能是由于采样造成的,请参阅,但我的应用程序中没有提到/配置采样。我所做的只是包括一个&only SDK(Microsoft.ApplicationInsights.servicefacture.Native v2.1.1),然后是一行代码(.AddSingleton((serviceProvider)=>FabricTelemetryInitializerExtension.CreateFabricTelemetryInitializer(serviceContext))。采样从何而来?采样是默认行为吗?当我在30分钟内发出10000个请求时,采样也没有生效。只有当我在30分钟内将计数增加到100000个请求时,才从文档中记录Azure Application Insights上发生的丢失事件:所有应用程序中默认启用自适应采样Application Insights ASP.NET和ASP.NET核心软件开发工具包(SDK)的最新版本。我认为这同样适用于服务结构。在页面上,您可以找到有关如何检测采样是否正在使用以及如何禁用/修改采样的信息。30秒内的10.000个请求约为5 rpm。这可能在采样开始前的范围内。要检查采样是否处于活动状态,请选中“itemCount”属性。如果它大于1,则表示正在对数据进行采样。