天蓝色AI QUERY结合开始和响应以计算平均值 [英] azure AI QUERY combine start and response to calculate average

查看:95
本文介绍了天蓝色AI QUERY结合开始和响应以计算平均值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于azure的应用洞察分析查询我还是很陌生.

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

我正在尝试从我拥有的数据中做出一些报告.

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

在表customEvents中,存在代表请求(又称事件)的开始和返回(又称开始与成功")的行,但是我无法弄清楚如何结合使用开始"和成功"来计算平均/制作报告.

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

推荐答案

为此,您需要一个联接,而不是一个联合.我花了一些时间在Application Insights中创建联接,但是请尝试一下.

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

您可能会遇到问题.对于同一操作,您有多个开始和成功.应该如何正确匹配?您应该具有与1个开始/成功"组合相关的唯一值.

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.

这篇关于天蓝色AI QUERY结合开始和响应以计算平均值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆