azure - Application Insights Analytics 同一会话中的多个事件
问题描述
对 AI 查询来说非常新,所以任何帮助都将不胜感激。
我们有许多用于特定操作的自定义事件,例如预约、订购产品、设置地址。我想运行一个查询来查看在同一会话中同时执行订购产品和设置地址的用户。我可以获得发生的任一事件的计数和 dcount,但很难指定两者都发生在同一个会话中我们捕获 User_authID 以及带有自定义事件的会话 ID。有任何想法吗?
谢谢,克里斯
解决方案
有几种方法可以做到这一点。我发现使用in
运算符和子查询是最容易阅读的。这是一个例子:
let timeRange = ago(1d);
let sessionsWithBothEvents = customEvents
| where timestamp > timeRange
| summarize CountEvent1=countif(name == "event1"), CountEvent2=countif(name == "event2") by session_Id
| where CountEvent1 > 0 and CountEvent2 > 0
| project session_Id;
customEvents
| where timestamp > timeRange
| where session_Id in (sessionsWithBothEvents)
// Here you have all the events in sessions that contained at least one instance of each event
// From here you can dcount users, etc.
需要注意的是,这种方法最多只能适用于符合条件的 100 万个会话 ID。这是由于in
运营商的限制。有关更多信息,请参阅https://docs.loganalytics.io/docs/Language-Reference/Scalar-operators/in_!in-operators。
推荐阅读
- java - 在定义的时间段后关闭活动
- objective-c - 调用方法时源文件中的目标 C 编辑器占位符
- excel-formula - 对同一列中的不同行数求和
- angular - ngx-scrollbar 不适用于 mat-dialog-content
- ios - 在一个屏幕中拥有一些 UITableViews 和一些 UICollectionViews
- c++ - 将一个类中创建的多地图数据传递给另一个类
- php - Laravel 在 PHPUnit 测试期间断言多个电子邮件收件人
- ios - JS 对象到 Swift 结构
- ionic-framework - SQLite 插件和 Ionic 框架无法在真实设备上运行
- oracle - 一个值的数据类型无效