我在 App Insights 中按 ProblemId 查询了异常的计数:
// exception count by problem ID
let start=datetime("2018-01-09T14:17:00.000Z");
let end=datetime("2018-01-10T14:17:00.000Z");
let timeGrain=5m;
let dataset=exceptions
// additional filters can be applied here
| where timestamp >= ago(24h)
| where client_Type == "PC" ;
dataset
| project problemId, cloud_RoleName, itemCount, details
| summarize count_=sum(itemCount) by problemId, cloud_RoleName, stacktrace_ = (tostring(details))
// calculate exception count for all exceptions
| union(dataset
| summarize count_=sum(itemCount)
| extend problemId="Overall")
| order by count_ desc
我还想包含堆栈跟踪,但我只想获取一组“problemId”的第一个“详细信息”列。有任何想法吗?谢谢
最佳答案
我认为没有用于汇总的 first() 运算符,但如果您只想为每个组提供一个(随机)值,则可以使用 any()
运算符。
喜欢
| summarize count_=sum(itemCount), any(details) by problemId, ...
“first”通常意味着组内的某种顺序,因此我不确定是否有一种简单的方法可以做到这一点而不会使查询变得更加复杂。
参见:https://docs.loganalytics.io/docs/Language-Reference/Aggregation-functions/any()
关于azure - 应用洞察 : how can i get first 'details' column in the 'problemId' group,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48190641/