Application Insights报告每个服务器请求的重复事件 [英] Application Insights Reporting Duplicate Events for each Server Request

查看:67
本文介绍了Application Insights报告每个服务器请求的重复事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Azure App Service下运行的API App,并安装了Application Insights以跟踪API调用的服务器端遥测.在Azure门户中查看Application Insights时,每个服务器调用都看到两个事件.每个事件都具有相同的时间戳,响应时间,遥测等完全相同的副本.我已经验证了Web服务器日志中只有一个事件,因此我不会无意中从客户端两次调用相同的函数.

I have an API App running under Azure App Service, with Application Insights installed to track server side telemetry of API calls. When viewing Application Insights in the Azure portal, I am seeing two events for every one server call. Each event has an exact duplicate with the same timestamp, response time, telemetry, etc. I have verified that only one event is in the web server logs, so I'm not accidentally calling the same function twice from the client.

以下是一些屏幕截图,以说明:

Here are a couple of screenshots to illustrate:

可能是什么原因造成的?我该如何解决?

What could be causing this? And how can I fix it?

推荐答案

有一种已知的情况可能导致数据重复:

There is a one known scenario that may lead to the data duplication:

  1. 未将应用程序集成到AI SDK中作为Azure部署 网络应用
  2. 在此步骤之后,将
  3. AI Extension安装到应用程序-> 您开始接收数据而无需修改代码
  4. 后来您决定使用AI的更强大功能,比如说定制 事件跟踪,将您的应用程序从VS和AI加载到AI 重新部署.
  1. Application is not onboarded to AI SDK is deployed as an Azure Web App
  2. AI Extension is installed to the app -> after this step you start to receive data without need to modify your code
  3. Later on you decided to use more powerful features of AI let's say custom event tracking and on-boarded your application to AI from VS and re-deployed.

现在,您可能会遇到以下情况:HTTP模块注册了两次,并且开始接收重复的请求数据.发生这种情况是因为AI nuget软件包在web.config中添加了HTTP模块定义,但是扩展安装将其他程序集放到了应用程序bin文件夹中,该文件夹在应用程序启动期间动态注册了HTTP模块-Microsoft.AI.HttpModule.dll(Microsoft.ApplicationInsights.Extensibility.HttpModule .dll(以前版本).要正确处理这种情况,在从VS部署的情况下,您需要选择设置->从目标中删除其他文件",以删除应用程序部署过程中剩余的扩展名.

Now you may end up in the situation when HTTP module is registered twice and you start to receive duplicate request data. It happens because AI nuget packages add HTTP module definition in web.config, but extension installation drops additional assembly into your application bin folder that registers HTTP module dynamically during app start - Microsoft.AI.HttpModule.dll (Microsoft.ApplicationInsights.Extensibility.HttpModule.dll in previous versions). To correctly handle this case you need to remove extension leftovers during your application deployment by choosing "Settings->Remove additional files from destination" in case of deploying from VS.

这篇关于Application Insights报告每个服务器请求的重复事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆