菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
391
0

【Azure 应用程序见解】通过Azure Funciton的门户启用Application Insights后,Application Insights无法收到监控数据

原创
05/13 14:22
阅读数 75026

问题描述

比较早期创建的Azure Funciton服务,近期发现在门户中已经启用了Application Insights功能,但是正确配置Applicaiton Insights后,却无法获取关联的Azure Function的监控数据?

 

问题分析

到目前为止,Azure Function已经经历了三个版本的发展,可以通过 FUNCTIONS_EXTENSION_VERSION 查看当前Azure Funciton的版本:

 

从官方的文档中,发现Application Insights已经在 Function V1.x, V2.x及V3.x的版本支持了。但是经过实测,V2.x, V3.x都能成功发送监控数据到Application Insights中而最早的V1.x版本却无法发送监控数据这与本文问题匹配。

最后经过咨询确认, 在中国区Function V1.X的集成除了要在门户中配置Applcation Insights外,还需要再Funciton的host.json中的applicationInsights一节修改endpoint并指向中国区的终结点:

Function host.json示例内容:

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 2.0.0)"
  },
  "applicationInsights": {
    "ingestionEndpoint": "https://dc.applicationinsights.azure.cn/v2/track",
    "liveEndpoint": "https://live.applicationinsights.azure.cn/QuickPulseService.svc"
  }
}

 

问题解决

1) Azure Function 页面中启用Application Insights

2) 修改Funciton的host.json文件,添加applicationInsights,ingestionEndpoint和liveEndpoint

 

 

参考资料

如何为 Azure Functions 配置监视: https://docs.azure.cn/zh-cn/azure-functions/configure-monitoring?tabs=v1

Azure Functions 运行时版本概述: https://docs.azure.cn/zh-cn/azure-functions/functions-versions

Application Insights Regions that require endpoint modification: https://docs.microsoft.com/en-us/azure/azure-monitor/app/custom-endpoints?tabs=net#regions-that-require-endpoint-modification

 

发表评论

0/200
391 点赞
0 评论
收藏