来自Azure Application Insights Analytics API的页面结果 [英] Page results from Azure Application Insights Analytics API

查看:99
本文介绍了来自Azure Application Insights Analytics API的页面结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以分页" Analytics API的结果?

Is it possible to "page" the results from the Analytics API?

如果我使用以下查询(通过http POST)

If I use the following Query (via http POST)

{
 "query":"customEvents | project customDimensions.FilePath, timestamp 
         | where timestamp > now(-100d) | order by timestamp desc | limit 25"
}

我在一个结果集中获得了多达10,000个结果.是否可以使用类似于事件API的$ skip的方式?例如跳过75拍25"或获取第4页结果的内容.

I get up to 10,000 results back in one result set. Is there any way to use something similar to the $skip that they have for the events API? Like "SKIP 75 TAKE 25" or something to get the 4th page of results.

推荐答案

不容易 .

如果可以使用/events ODATA查询路径而不是/query路径,则支持分页.但不是像您一样真正的自定义查询.

If you can use the /events ODATA query path instead of the /query path, that supports paging. but not really custom queries like you have.

要获得类似分页的功能,您需要进行一个复杂的查询,并使用summarizemakeList并在查询中创建一个rowNum字段,然后使用mvexpand重新展开列表,然后通过rowNum进行过滤.它非常复杂且不直观,类似于:

To get something like paging, you need to make a complicated query, and use summarize and makeList and invent a rowNum field in your query, then use mvexpand to re-expand the lists and then filter by the rowNum. it's pretty complicated and unintuitive, something like:

customEvents 
| project customDimensions.FilePath, timestamp 
| where timestamp > now(-100d) 
| order by timestamp desc 
// squishes things down to 1 row where each column is huge list of values
| summarize filePath=makelist(customDimensions.FilePath, 1000000)
    , timestamp=makelist(timestamp, 1000000)
    // make up a row number, not sure this part is correct
    , rowNum = range(1,count(strcat(filePath,timestamp)),1)
// expands the single rows into real rows
| mvexpand filePath,timestamp,rowNum limit 1000000
| where rowNum > 0 and rowNum <= 100 // you'd change these values to page

我认为appinsights用户语音中已经存在支持查询语言中的分页运算符的请求.

i believe there's already a request on the appinsights uservoice to support paging operators in the query language.

这里的另一个假设是,您在工作时基础表中的数据没有改变.如果在通话之间出现了新数据,例如

the other assumption here is that data isn't changing in the underlying table while you're doing work. if new data appears between your calls, like

  1. 给我0-99行
  2. 出现50个新行
  3. 给我100-199行

然后第3步实际上是 给您刚在第1步中获得的50条重复行.

then step 3 is actually giving you back 50 duplicate rows that you just got in step 1.

这篇关于来自Azure Application Insights Analytics API的页面结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆