2016-11-23 46 views
0

我在应用程序的见解分析聚集在应用洞察分析的标量处理

let total = exceptions 
| where timestamp >= ago(7d) 
| where problemId contains "Microsoft.ServiceBus" 
| summarize sum(itemCount); 

let nullContext = exceptions 
| where timestamp >= ago(7d) 
| where problemId contains "Microsoft.ServiceBus" 
| where customDimensions.["SpecificTelemetry.Message"] == "HttpContext.Current is null" 
| summarize sum(itemCount); 

let result = iff(total == nullContext, "same", "different"); 
result 

此查询,但我得到这个错误

无效的关系运算符

我很惊讶,因为昨天用相同的代码(据我记得),我得到一个不同的错误,说支票的两面都需要标量,但我的理解是聚合即使它显示一个值(在sum_countItem下)也不是标量。但是找不到改变它的方法,或者现在摆脱这项工作。

谢谢

回答

1

几个问题。 首先 - 无效的关系运算符可能是由于let语句之间的空行造成的。 AI Analytics允许您在同一窗口中编写多个查询,并使用空行来分隔这些查询。因此,为了将所有语句作为单个查询运行,您需要消除空行。

关于“关系运算符的左右侧必须是标量”的错误 - “汇总”运算符的结果是一个表而不是标量。它可以包含一行/一列或多个(如果在总结中添加“by”子句,会发生什么情况)。 要实现您想要做的事情,您可能需要使用如下单个查询:

exceptions 
| where timestamp >= ago(7d) 
| where problemId contains "Microsoft.ServiceBus" 
| extend nullContext = customDimensions.["SpecificTelemetry.Message"] == "HttpContext.Current is null" 
| summarize sum(itemCount) by nullContext