Application Insight 分析枢轴

Application Insight Analytics Pivot

有没有办法在 Azure Application Insight 分析查询中进行调整? SQL 有 Pivot Keyword, can similar be achieved in 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_ 

我正在寻找白天明智的东西。

实现与您的需求类似的最简单方法是使用:

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

这将在每天每种类型的输出中给出一行。不完全是你想要的,但在图表中呈现时它会看起来不错(将为你提供每种类型的线)。

要获得与您在示例中输入的内容类似的 table 会更加困难,但此查询应该可以解决问题:

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