0

我想显示总请求的数量,以及被跟踪的失败请求的总数 bij ApllicaionInsights。当表中没有失败的请求时,查询将返回一个空对象(通过 API,在门户中它会说:'NO RESULTS FOUND 0 records matching'。)

我尝试设置一个为 0 的变量,并在连接中给它一个新值。我还尝试检查连接值是否为空或为空,并在此情况下给它一个 0 值。但没有一个有帮助..

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

4

1 回答 1

1

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

请求 | 其中时间戳 > 以前(1h)| 总结 totalCount=count(), totalFailCount = countif(success == false) by bin(timestamp, 1m)

于 2019-05-20T12:57:57.720 回答