【问题标题】:"Failed to resolve 'top' key column" Error in Application Insights Analytics Custom DimensionsApplication Insights Analytics 自定义维度中的“无法解析‘顶部’键列”错误
【发布时间】:2017-05-25 14:43:54
【问题描述】:

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

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

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

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

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

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

【问题讨论】:

  • 接受的答案确实有效,但具有误导性。请参阅下面的答案。

标签: azure azure-application-insights ms-app-analytics


【解决方案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 后还有更多查询?)

【讨论】:

  • 修复了错误,谢谢。我最初使用联合的原因是我刚刚修改了在打开使用联合的分析视图后自动填充的查询。另一个问题,错误已经消失,但现在我得到“没有找到结果”。我需要转换 toguid 而不是 tostring 吗?
  • 嗯,我自己一直使用tostring,即使对于可以解析为 guid 的值也是如此。请注意它区分大小写!更奇怪的是,只有== 是。将其更改为contains,它将比较不区分大小写。
  • @PeterBons “看来你不能在投影上做一个顶部”是不正确的。你可以做一个项目的顶部,但你需要先投影它:)
  • @yonisha 好吧,我的答案确实有效,但感谢您的更正和更新我的答案的机会。不确定它是否值得一票否决。特别是因为我没有把它说成一个事实,我说它(在我看来)是这样的。
【解决方案2】:

如果你想在顶部使用'timestamp'列,你必须投影它。

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-20
    • 2014-06-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多