SQL Server 和服务总线的 Azure Functions 依赖关系跟踪到 Application Insights

dot*_*tep 2 azure azure-application-insights azure-functions .net-6.0

以前我有 Azure Web App (.net core),它成功地将 SQL Server 和服务总线依赖项跟踪到 Application Insights 中。它无法与 Azure Functions 一起使用。

环境

  • 点网6
  • 点网隔离模式
  • 日志级别默认设置为“信息”。
  • 使用 Azure Functions 消耗计划的 Azure 环境。
  • Application Insights 密钥已配置。

我在前端有 Azure API 管理,后端是 Azure Function,它调用 SQL Server 和服务总线。

  • Api 管理服务对 Azure 函数的依赖性已成功解决,但 Azure 函数对其他组件的依赖性不起作用。

dot*_*tep 7

我知道我正在发布我自己的答案。此外,将来也有可能出现一些好的解决方案,或者以进程内模式的方式进行集成。

然后按照步骤操作。

  1. 添加套餐
Microsoft.ApplicationInsights.WorkerService
Run Code Online (Sandbox Code Playgroud)
  1. 在program.cs中配置主机。
services.AddApplicationInsightsTelemetryWorkerService();
Run Code Online (Sandbox Code Playgroud)

更多信息请访问 https://learn.microsoft.com/en-us/azure/azure-monitor/app/worker-service