2

我在 Application Insights 中有一些数据,我正在使用 Analytics 视图编写针对它的查询。

我可以看到我有一个跟踪,其中的 CustomDimensions 包含一个名为 ActivityID 的属性,它是一个 guid:

在此处输入图像描述

我现在要做的是运行另一个查询以返回包含该 ActivityId 的所有跟踪。

以此为指导,我目前有以下内容

union (traces
| extend ActivityId = tostring(customDimensions.ActivityId)
| project ActivityId
| where ActivityId  == "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
| top 101 by timestamp desc

但是,这将返回以下语法错误消息:

Failed to resolve 'top' key column

我究竟做错了什么?如果可能的话,我也将不胜感激并解释错误消息。

4

2 回答 2

1

除非您实际上在投影中包含时间戳列,否则您无法进行top投影。

我做了:

union (traces)
| top 101 by timestamp desc
| project session_Id

所以这应该有效

union (traces
| extend ActivityId = tostring(customDimensions.ActivityId)
| where ActivityId  == "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
| top 101 by timestamp desc
| project ActivityId

然后它就起作用了。您的完整查询是什么(我想您使用的还有更多union?)

于 2017-05-25T15:00:40.853 回答
0

如果要在顶部使用它,则必须投影“时间戳”列。

traces
| extend ActivityId = tostring(customDimensions.ActivityId)
| project ActivityId, timestamp
| where ActivityId  == "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
| top 101 by timestamp desc

*请注意,您也不需要使用union

于 2017-07-29T12:17:59.780 回答