azure AI QUERY将开始和响应组合起来计算平均值

时间:2016-12-12 11:59:02

标签: azure azure-application-insights

我对azure的应用洞察分析查询非常陌生。

我试图用我的数据做一些报告。

在表customEvents中,有一些行代表一个请求(也就是事件)的开始和返回(又名Start& Success),但我无法弄清楚如何将Start和Success结合起来计算平均值/进行报告。

let table1 = customEvents | extend Start=timestamp | where customDimensions.Action == "Start" and customDimensions.Event == "A" | project Start, operation_Id;
let table2 = customEvents | extend Success=timestamp | where customDimensions.Action == "Success" and customDimensions.Event == "A" | project Success, operation_Id;

union  table* 

令人失望的是,我只能得到以下结果:

Start                       Success                 operation_Id
___________________________________________________________________
2016-12-12T07:09:23.466Z    null                        EktA4
2016-12-12T07:09:32.479Z    null                        EktA4
2016-12-12T07:09:37.392Z    null                        EktA4
2016-12-12T09:09:27.645Z    null                        YpgOq
null                        2016-12-12T07:09:26.551Z    EktA4
null                        2016-12-12T07:09:33.848Z    EktA4
null                        2016-12-12T07:09:38.265Z    EktA4
null                        2016-12-12T09:09:29.927Z    YpgOq

1 个答案:

答案 0 :(得分:1)

你需要一个联盟,而不是联盟。我花了一些时间在Application Insights中创建联接,但试试这个。

let startEvents = customEvents
| where customDimensions.Action == "Start" and customDimensions.Event == "A"    
| extend Start = timestamp 
    | project operation_Id, Start;
customEvents
| where customDimensions.Action == "Succes" and customDimensions.Event == "A"    
    | extend Success = timestamp 
    | join kind=leftouter startEvents on operation_Id
    | project operation_Id, Start, Success

修改

但您可能会遇到问题。您可以为同一操作启动多次并取得成功。应该如何正确匹配?您应该具有与1个开始/成功组合相关的唯一值。