我正在运行以下查询,它返回服务的多个实例,例如 firefox 和 firefox#1 firefox#2。
当我显示图表时,我会看到多行而不是单个 Firefox 行,所有 3 个实例的平均值合为一个。
Perf
| where InstanceName
has "firefox"
and CounterValue > 0
| summarize ProcessorUsage = avg(CounterValue)
by bin(TimeGenerated,
5m), InstanceName
因此,与其返回 firefox#1 和 firefox#2,不如对所有 3 个的平均值进行分组。
我希望能够查看虚拟机上每个进程的 CPU 使用情况,而不是查看同一应用程序的多个实例。
最佳答案
更新 0809: 添加另一个实例,例如 chrome
Perf
| where (InstanceName has "firefox" and CounterValue >0) or (InstanceName has "chrome" and CounterValue >0)
| extend new_InstanceName = iif(InstanceName has "firefox", "firefoxavg","chromeavg" )
| summarize ProcessorUsage = avg(CounterValue) by bin(TimeGenerated, 5m), new_InstanceName
<小时/>
您可以为包含“firefox”的记录添加一个新列(使用扩展运算符),然后在摘要句子中使用新列。
代码如下:
Perf
| where InstanceName has "firefox" and CounterValue > 0
| extend new_InstanceName ="firefoxavg"
| summarize ProcessorUsage = avg(CounterValue) by bin(TimeGenerated, 5m), new_InstanceName
关于azure - Log Analytics 将流程实例分组为一个流程名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57407617/