如何修复 'empty join will fail query'

How to fix 'empty join will fail query'

我想显示请求总数,以及正在跟踪的失败请求总数 bij AplicaionInsights。 当 table 中没有失败的请求时,查询将 return 一个空对象(通过 API,在门户中它会说:“没有找到 0 个记录匹配的结果”。)

我试过设置一个 0 变量,并在连接中给它一个新值。 我还尝试检查连接值是否为 null 或为空,并在出现时将其设为 0。 但是 none 确实有帮助..

requests
| where timestamp > ago(1h) 
| summarize totalCount=sum(itemCount) by timestamp
| join (
   requests
   | where success == false and timestamp > ago(1h)
   | summarize totalFailCount =sum(itemCount) by timestamp
) on timestamp
| project timestamp, totalCount, totalFailCount 

我想要的结果是,如果没有失败的请求,totalCount 应该显示 0

在这种情况下您似乎不需要连接,如果您按时间戳聚合,您将根据此列中的实际值获得存储桶,大多数人通常喜欢按时间计数 "buckets"例如一分钟,这是一个例子:

请求 |其中时间戳>前(1小时) |通过 bin(timestamp, 1m)

总结 totalCount=count(), totalFailCount = countif(success == false)