azure AI QUERY combine start and response to calculate average

北城以北 提交于 2019-12-11 03:52:09

问题


I'm quite new to azure's application insights analytics query.

I'm trying to make some reports out of the data I have.

In the table customEvents, there are rows that represents the start and the return (aka Start & Success) of a request (aka Event), but I cannot figure out how to combine the Start and Success for calculating an average/making a report.

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* 

Disappointingly, I can only get the following result:

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:


You need a join for that, not a union. It took me a while to create joins in Application Insights but try this.

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

Edit:

You might run into a problem though. You have multiple starts and success for the same operation. How should those be matched correctly? You should have a unique value that relates to 1 Start/Success combination.



来源:https://stackoverflow.com/questions/41100410/azure-ai-query-combine-start-and-response-to-calculate-average

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!