0

有没有办法在 Azure 应用程序洞察分析查询中进行透视?SQL 有一个Pivot 关键字,在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_ 

我正在寻找低于天数的东西。在此处输入图像描述

4

1 回答 1

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
于 2017-06-21T03:33:33.687 回答