You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为什么通过App Insights查询Azure Function的Invocation Id为空

排查方案
  • 第一步:确认Application Insights基础集成配置正常
    进入Function App控制台的「配置」-「应用程序设置」,检查是否存在APPLICATIONINSIGHTS_CONNECTION_STRING(推荐)或APPINSIGHTS_INSTRUMENTATIONKEY配置项,值与目标App Insights实例对应。
  • 第二步:检查host.json日志采集配置
    日志级别设得过高、采样规则过滤都会导致Invocation Id字段未被采集,参考如下正确配置:
{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    },
    "logLevel": {
      "Function": "Information",
      "Host.Aggregator": "Information",
      "Host.Results": "Information"
    }
  }
}

配置更新后需要重启Function App生效,新产生的调用日志才会包含完整字段。

  • 第三步:校验查询语句与字段名
    不同版本的Function Runtime自定义维度的键名可能存在大小写差异,先执行以下查询确认customDimensions中实际存在的键:
requests
| where cloud_RoleName =~ 'appname' and operation_Name =~ 'Gen'
| take 10
| project customDimensions

若键名是小写invocationId,将你原查询的取值字段改为customDimensions['invocationId']即可。

  • 第四步:换表查询验证
    如果你使用的是隔离进程模型的Function,Invocation Id可能未上报到requests表,可以尝试查询traces表获取:
traces
| where cloud_RoleName =~ 'appname' and customDimensions['FunctionName'] =~ 'Gen'
| project invocationId = customDimensions['InvocationId'], operation_Id, timestamp
| order by timestamp desc
| take 10

内容的提问来源于stack exchange,提问作者Deepak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.24 09:36:00