azure-application-insights - 如何在 azure 中检索与另一个属性相对应的自定义属性
问题描述
我正在尝试编写一个 kusto 查询来检索自定义属性,如下所示。
我想检索计数pkgName
和对应的organization
. 我可以检索 pkgName 的计数,代码附在下面。
let mainTable = union customEvents
| extend name =replace("\n", "", name)
| where iif('*' in ("*"), 1 == 1, name in ("*"))
| where true;
let queryTable = mainTable;
let cohortedTable = queryTable
| extend dimension = customDimensions["pkgName"]
| extend dimension = iif(isempty(dimension), "<undefined>", dimension)
| summarize hll = hll(itemId) by tostring(dimension)
| extend Events = dcount_hll(hll)
| order by Events desc
| serialize rank = row_number()
| extend dimension = iff(rank > 10, 'Other', dimension)
| summarize merged = hll_merge(hll) by tostring(dimension)
| project ['pkgName'] = dimension, Counts = dcount_hll(merged);
cohortedTable
请帮助我了解organization
每个pkgName
项目。
解决方案
请尝试这个简单的查询:
customEvents
| summarize counts=count(tostring(customDimensions.pkgName)) by pkgName=tostring(customDimensions.pkgName),organization=tostring(customDimensions.organization)
请随时修改它以满足您的要求。
如果以上不满足您的要求,请尝试创建另一个包含pkgName
和organization
关系的表。然后使用join
运算符连接这些表。例如:
//create a table which contains the relationship
let temptable = customEvents
| summarize by pkgName=tostring(customDimensions.pkgName),organization=tostring(customDimensions.organization);
//then use the join operator to join these tables on the keyword pkgName.
推荐阅读
- javascript -
使用 JS 在可见换行符上拆分文本 [不带 \n 或] - ios - 在视图控制器中自动调整文本大小
- html - 表单验证使用 oninvalid setCustomValidity 按钮在服务器上运行
- java - 是否每个“新”都会导致至少一个 Classloader.loadClass 调用
- powershell - PowerShell 哈希表更新适用于所有条目
- c# - 如何为从枚举生成的表创建外键?
- android - 导航栏下方的底部导航栏
- postscript - PostScript 不会在柯尼卡美能达上将两页装订在一起
- javascript - Promise.all 里面有 Promise 链
- excel - VBA / 宏从 32 位升级到 64 位