为什么我的 appinsight 查询给我随机结果?
why my appinsight query gives me random result?
这是我的 appinsight 查询。基本上我每 15 分钟就有一个监控程序 运行s 并记录一个数据矩阵。我想比较 最新矩阵与先前矩阵 和 最新矩阵与先前矩阵 ,并且仅当两者比较显示跳跃时才创建警告(例如 20 %)
//get the requests I am interested in first
let allRequest=requests
| where operation_Name == "SearchServiceFieldMonitor" and timestamp > ago(4h)
| extend IndexerMismatch = tostring(customDimensions.IndexerMismatch)
| extend Mismatch = split(IndexerMismatch, " in ")
| extend difference = toint(Mismatch[0])
, field = tostring(Mismatch[1])
, indexer = tostring(Mismatch[2])
, index = tostring(Mismatch[3])
, service = tostring(Mismatch[4])
, timestamp
|project field, indexer,index,service, timestamp,difference;
//get the latest requests
let latestRequest=allRequest
|summarize latesttime=arg_max(timestamp, *) by field, indexer,index,service
|project latestdifference=difference,latesttime,field, indexer,index,service;
//get the requests before latest (latest-1)
let previousRequest=allRequest
|join latestRequest on field, indexer,index,service
|extend timestampcopy=timestamp
|where timestamp<latesttime
|summarize previousdifftime=arg_max(timestamp, *) by field, indexer,index,service
|project latestdifference,previousdifference=difference,previousdifftime,latesttime,field, indexer,index,service;
//get the requests before latest-1, so latest-2
let beforepreviousRequest=allRequest
|join previousRequest on field, indexer,index,service
|where timestamp<previousdifftime
|summarize prevPrevtime=arg_max(timestamp, *) by field, indexer,index,service
|project latestdifference,previousdifference,prevprevdifference=difference,prevPrevtime,previousdifftime,latesttime,field, indexer,index,service;
// show requests that there is a jump of difference between latest and (latest-1) and latest and (latest-1)
beforepreviousRequest
|where (latestdifference -previousdifference)/previousdifference>0.2 and (latestdifference -prevprevdifference)/prevprevdifference>0.2
但是,此查询给出了随机结果。如果我点击 运行 按钮几次,它可能会显示 0 条记录、1 条记录或几条记录。我正在使用的连接有问题吗?
默认 join kind 是“innerunique”,returns 从左边算起只有一行(可以是任意一行)。将类型更改为“内部”或任何其他类型以获得一致的结果。
这是我的 appinsight 查询。基本上我每 15 分钟就有一个监控程序 运行s 并记录一个数据矩阵。我想比较 最新矩阵与先前矩阵 和 最新矩阵与先前矩阵 ,并且仅当两者比较显示跳跃时才创建警告(例如 20 %)
//get the requests I am interested in first
let allRequest=requests
| where operation_Name == "SearchServiceFieldMonitor" and timestamp > ago(4h)
| extend IndexerMismatch = tostring(customDimensions.IndexerMismatch)
| extend Mismatch = split(IndexerMismatch, " in ")
| extend difference = toint(Mismatch[0])
, field = tostring(Mismatch[1])
, indexer = tostring(Mismatch[2])
, index = tostring(Mismatch[3])
, service = tostring(Mismatch[4])
, timestamp
|project field, indexer,index,service, timestamp,difference;
//get the latest requests
let latestRequest=allRequest
|summarize latesttime=arg_max(timestamp, *) by field, indexer,index,service
|project latestdifference=difference,latesttime,field, indexer,index,service;
//get the requests before latest (latest-1)
let previousRequest=allRequest
|join latestRequest on field, indexer,index,service
|extend timestampcopy=timestamp
|where timestamp<latesttime
|summarize previousdifftime=arg_max(timestamp, *) by field, indexer,index,service
|project latestdifference,previousdifference=difference,previousdifftime,latesttime,field, indexer,index,service;
//get the requests before latest-1, so latest-2
let beforepreviousRequest=allRequest
|join previousRequest on field, indexer,index,service
|where timestamp<previousdifftime
|summarize prevPrevtime=arg_max(timestamp, *) by field, indexer,index,service
|project latestdifference,previousdifference,prevprevdifference=difference,prevPrevtime,previousdifftime,latesttime,field, indexer,index,service;
// show requests that there is a jump of difference between latest and (latest-1) and latest and (latest-1)
beforepreviousRequest
|where (latestdifference -previousdifference)/previousdifference>0.2 and (latestdifference -prevprevdifference)/prevprevdifference>0.2
但是,此查询给出了随机结果。如果我点击 运行 按钮几次,它可能会显示 0 条记录、1 条记录或几条记录。我正在使用的连接有问题吗?
默认 join kind 是“innerunique”,returns 从左边算起只有一行(可以是任意一行)。将类型更改为“内部”或任何其他类型以获得一致的结果。