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

无法为Azure Function App创建平均响应时间仪表板,寻求正确日志查询

Azure Function App 平均响应时间日志查询及仪表板配置

基础全局平均响应时间查询

适用于查看整个Function App的整体平均响应时间趋势:

requests
| where cloud_RoleName == "<你的Function App名称>"  // 替换为实际应用名称
| where success == true  // 可选:仅统计成功请求,需包含失败请求则删除此行
| summarize avgResponseTimeMs = avg(duration) by bin(timestamp, 5m)  // 按5分钟粒度聚合,可调整为1m/15m/1h等
| render timechart

按单个函数拆分的响应时间查询

用于对比不同函数的平均响应时间表现:

requests
| where cloud_RoleName == "<你的Function App名称>"
| extend functionName = tostring(customDimensions["FunctionName"])
| where isnotempty(functionName)
| summarize avgResponseTimeMs = avg(duration) by functionName, bin(timestamp, 5m)
| render timechart with (series=functionName)

包含冷启动区分的响应时间分析(可选)

如果需要排查冷启动对响应时间的影响:

requests
| where cloud_RoleName == "<你的Function App名称>"
| extend functionName = tostring(customDimensions["FunctionName"])
| extend isColdStart = tostring(customDimensions["IsColdStart"]) == "True"
| summarize avgResponseTimeMs = avg(duration) by functionName, isColdStart, bin(timestamp, 5m)
| render timechart with (series=functionName, split=isColdStart)

仪表板配置操作

  1. 登录Azure门户,进入Function App关联的Application Insights资源
  2. 左侧菜单选择「日志」,粘贴上述查询并运行验证结果
  3. 点击查询窗口顶部的「固定到仪表板」,选择目标仪表板完成添加

注意事项

  • 确保Function App已正确集成Application Insights,否则无法采集requests类日志
  • duration字段单位为毫秒,如需转换为秒可修改为avg(duration / 1000)
  • 时间粒度bin(timestamp, 5m)可根据监控需求灵活调整

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 12:08:08