将 Application Insights 与多个部署槽一起使用

Using Application Insights with multiple deployment slots

我开始针对具有多个部署的 ASP.NET Web 应用程序实施 Application Insights; Prod、Staging、Dev、Dev2。目前,生产槽空着,部署在 staging、dev 和 dev2 中。

应用程序运行状况磁贴显示了对 Prod 主页的请求,但我真的想查看暂存、dev 和 dev2 的遥测数据。是否可以为我的 Web 应用程序中的所有槽使用 1 个 Application Insights 资源,还是我必须为每个槽创建一个单独的 Application Insights?

您可以使用 custom properties which will indicate your environment, and then slice and dice according to that property, using either Metric Explorer or Analytics 扩展遥测。

您可以在此处阅读更多内容:Application Insights support for Multiple Environments, Stamps and App Versions,特别是 'Multi Stamp Support'。

我已经解决了这个问题。我通过门户为已部署的应用程序启用 Application Insights,这似乎只为 'main' 生产槽中部署的内容启用遥测收集。在我的例子中,这是默认的 'This web app has been successfully created' 蓝色登陆屏幕。尽管我的其他 3 个部署槽已经部署了应用程序,但没有收集到这些数据。

为了允许收集所有槽,return 到 Visual Studio 并通过那里配置 Application Insights。然后,您可以将应用程序重新部署到您希望的任何部署槽,然后将进行 OOTB 遥测收集。