App Insights - 透视结果

时间:2017-07-24 14:19:52

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

如何转动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 

1 个答案:

答案 0 :(得分:2)

是的,只需添加

| 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")