Application Insights Analytics doing sub selects

做~自己de王妃 提交于 2019-12-11 07:11:04

问题


I am using this reference documentation for Application Insights.

How can I do a sub-select using the output of a different query?

//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.})

Is a join better in this scenario. Which would have better performance.


回答1:


You can use let statement to achieve this.

Here is an example from the Analytics documentation, I hope this helps:

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;

Edit: By default the maximum number of elements returned by the makeset() function is 128. The MaxSetSize should be specified for larger dataSets.



来源:https://stackoverflow.com/questions/42258994/application-insights-analytics-doing-sub-selects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!