Application Insight Analytics Pivot

时间:2017-06-16 08:58:43

标签: azure azure-application-insights ms-app-analytics

有没有办法在Azure应用程序洞察分析查询中进行转换? SQL有一个Pivot Keyword,可以在Application insight Analytics中实现类似吗?

当我运行以下查询时,我会获得例外和计数,但我希望看到一天中的趋势

exceptions 
| where timestamp >= ago(24h) 
| extend Api = replace(@"/(\d+)",@"/xxxx", operation_Name)
| summarize count() by type
| sort by count_ desc 
| limit 10
| project Exception = type, Count = count_ 

我正在寻找一天下面的东西。 enter image description here

1 个答案:

答案 0 :(得分:1)

实现类似于您需要的东西的最简单方法是使用:

exceptions
| where timestamp >= ago(7d)
| summarize count() by type, bin(timestamp, 1d) 

这将在输出中为每天每行输入一行。不完全是你想要的,但是当在图表中渲染时它看起来会很好(会为每种类型提供一条线)。

要获得类似于您在示例中放置的表格会更困难,但此查询应该可以解决问题:

exceptions 
| where timestamp >= startofday(ago(3d)) 
| extend Api = replace(@"/(\d+)",@"/xxxx", operation_Name)
| summarize count() by type, bin(timestamp, 1d)
| summarize 
    Today = sumif(count_, timestamp == startofday(now())),
    Today_1 = sumif(count_, timestamp == startofday(ago(1d))),
    Today_2 = sumif(count_, timestamp == startofday(ago(2d))),
    Today_3 = sumif(count_, timestamp == startofday(ago(3d)))
    by type