App Insights - 透视结果

App Insights - Pivot result

如何调整 App Insights 分析查询的结果?

例如,我希望每个 cloud_RoleInstace:

都有一个值列
performanceCounters  
| where timestamp > todatetime("2017-07-24T13:44:00.251Z")  
    and timestamp < todatetime("2017-07-24T13:49:00.251Z")   
| where name in ("% Processor Time")//, "Request Execution Time")  
| sort by timestamp asc nulls last  
| project timestamp, value, cloud_RoleInstance 

是的,只需添加

| evaluate pivot(cloud_RoleInstance)

或可能更复杂但可能更正确:

| summarize value=sum(value) by bin(timestamp, 1m), cloud_RoleInstance 
| evaluate pivot(cloud_RoleInstance, sum(value))

您的查询:)

此外,您可以简化查询的时间部分以使用 between 运算符

| where timestamp between(todatetime("2017-07-24T13:44:00.251Z")..todatetime"2017-07-24T13:49:00.251Z")