Application Insights Analytics执行子选择

Pra*_*ddy 1 azure-application-insights ms-app-analytics

我正在使用Application Insights的这个参考文档.

如何使用其他查询的输出进行子选择?

//Query 1
Events 
| where  Timestamp >= ago(30min) and Data contains('SomeString')
| project TraceToken

//I would like to use the first query's output in the subselect here.
Events 
| where TraceToken in ({I would like to use the First query's output here.})
Run Code Online (Sandbox Code Playgroud)

在这种情况下,联接是否更好.哪个会有更好的表现.

Dmi*_*eev 9

您可以使用letstatement来实现此目的.

以下是Analytics文档中的示例,我希望这有助于:

let topCities =  toscalar ( // convert single column to value
   requests
   | summarize count() by client_City 
   | top 4 by count_ 
   | summarize makeset(client_City));
requests
| where client_City in (topCities) 
| summarize count() by client_City;
Run Code Online (Sandbox Code Playgroud)

编辑:默认情况下,makeset()函数返回的最大元素数为128.应为较大的dataSets指定MaxSetSize.