我有一个查询来检查平均响应时间:
- 过去 24 小时
- 24-192 小时
- 它们之间的差异以百分比表示
let requests0to24HoursAgo = requests
| where timestamp > ago(24h)
| summarize last0to24HoursAverageRequestDuration=avg(duration), id=1;
let requests24to192HoursAgo = requests
| where timestamp > ago(192h)
| where timestamp < ago(24h)
| summarize last24to192HoursAverageRequestDuration=avg(duration), id=1;
let diff = requests0to24HoursAgo
| join
requests24to192HoursAgo
on id
| extend Diff = (last0to24HoursAverageRequestDuration - last24to192HoursAverageRequestDuration) / last24to192HoursAverageRequestDuration * 100
| project
["Average response (last 0-24 hours)"]=last0to24HoursAverageRequestDuration,
["Average response (last 24-192 hours)"]=last24to192HoursAverageRequestDuration,
Diff;
diff
这在 Azure 的“日志”部分中完美运行,但是一旦我将查询固定到仪表板,它就无法使用日期范围“在查询中设置”运行它,并为其中 2 个值返回 NaN。
当我单击“打开编辑窗格”时,将其设置为“在查询中设置”并运行它,它可以工作。当我然后单击“应用”时,它仍然在仪表板上损坏。