gpt4 book ai didi

asp.net - 使用适用于 .NET 的 Azure Application Insights Auto Instrumentations 几乎是不可能的吗?

转载 作者:行者123 更新时间:2023-12-02 07:51:40 25 4
gpt4 key购买 nike

我正在尝试为应用服务上托管的现有 ASP.NET Web 应用程序启用 Azure Application Insights 自动检测。它不起作用,所以我尝试调查并从 https://learn.microsoft.com/en-us/troubleshoot/azure/azure-monitor/app-insights/auto-instrumentation-troubleshoot?source=recommendations 找到了此部分

A diagnostics library was detected

Auto-instrumentation fails if it detects the following libraries:

System.Diagnostics.DiagnosticSource
Microsoft.AspNet.TelemetryCorrelation
Microsoft.ApplicationInsights

These libraries must be removed for auto-instrumentation to succeed.

就我而言,我的 Web 应用程序依赖于 System.Diagnostics.DiagnosticSource。但令我惊讶的是,这个库是 Azure.Core 的传递依赖项,并且大多数与 Azure 服务连接的 sdk 都依赖于 Azure.Core。我们不太可能希望在不连接到 Azure 服务的情况下在 Azure 上部署 Web 应用程序。

那么这是否意味着在重要的应用程序上使用自动检测几乎是不可能的?

最佳答案

Isn't it nearly impossible to use Azure Application Insights Auto Instrumentations for .NET?

感谢@Peter Bons 的评论。

据此MSDoc , 支持自动检测

Windows - .NET Core LTSLinux - Only ASP.NET Core 6.0.

请检查支持的自动检测environments .

这并非不可能,但自动检测可能无法按照您指定的方式跟踪所有所需的遥测数据。

为避免这一切,建议手动配置Application Insights

  • 当您想要跟踪简单且小型应用程序的数据时,自动检测非常有效。

  • 如果您想跟踪任何自定义事件和指标,那么最好使用手动 Application Insights。

appsettings.json 文件中添加 ApplicationInsights ConnectionString

请引用以下链接

关于asp.net - 使用适用于 .NET 的 Azure Application Insights Auto Instrumentations 几乎是不可能的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75857110/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com