Workbooks support hierarchical views via tree-grids. Trees allow some rows to be expandable into the next level for a drill-down experience.
The example below shows container health metrics (working set size) visualized as a tree grid. The top-level nodes here are Azure Kubernetes Service (AKS) nodes, the next level are pods and the final level are containers. Notice that you can still format your columns like in a grid (heatmap, icons, link). The underlying data source in this case is an LA workspace with AKS logs.
- Switch the workbook to edit mode by clicking on the Edit toolbar item.
- Use the Add query link to add a log query control to the workbook.
- Select the query type as Log, resource type (e.g. Application Insights) and the resources to target.
- Use the Query editor to enter the KQL for your analysis
requests | summarize Requests = count() by ParentId = appName, Id = name | extend Kind = 'Request', Name = strcat('🌐 ', Id) | union (requests | summarize Requests = count() by Id = appName | extend Kind = 'Request', ParentId = '', Name = strcat('📱 ', Id)) | project Name, Kind, Requests, Id, ParentId | order by Requests desc
- Set the visualization to Grid
- Click the Column Settings button to open the settings pane
- In the Tree/Group By Settings section at the bottom, set:
- Tree Type:
Parent/Child
- Id Field:
Id
- Parent Id Field:
ParentId
- Show the expander on:
Name
- Expand the top level of the tree:
checked
- Tree Type:
- In Columns section at the top, set:
- Id - Column Renderer:
Hidden
- Parent Id - Column Renderer:
Hidden
- Requests - Column Renderer:
Bar
, Color:Blue
, Minimum Value:0
- Id - Column Renderer:
- Click the Save and Close button at the bottom of the pane.
This is how the tree will look like in read mode:
Setting | Explanation |
---|---|
Id Field |
The unique Id of every row in the grid |
Parent Id Field |
The id of the parent of the current row |
Show the expander on |
The column on which to show the tree expander. It is common for tree grids to hide their id and parent id field because they are not very readable. Instead, the expander appears on a field with a more readable value - like the name of the entity |
Expand the top level of the tree |
If checked, the tree grid will be expanded at the top level. Useful if you want to show more information by default |
Grouping allows you to build hierarchical views similar to the ones above with significantly simpler queries. You do lose aggregation at the inner nodes of the tree, but that may be alright for some scenarios. Use Group By to build tree views when the underlying result set cannot be transformed into a proper tree form - e.g. in the case of alert, health and metric data. If you data source is from KQL, then you should choose to build tree views as described above.
- Switch the workbook to edit mode by clicking on the Edit toolbar item.
- Use the Add query link to add a log query control to the workbook.
- Select the query type as Log, resource type (e.g. Application Insights) and the resources to target.
- Use the Query editor to enter the KQL for your analysis
requests | summarize Requests = count() by App = appName, RequestName = name | order by Requests desc
- Set the visualization to Grid
- Click the Column Settings button to open the settings pane
- In the Tree/Group By Settings section at the bottom, set:
- Tree Type:
Group By
- Group By:
App
- Then By:
None
- Expand the top level of the tree:
checked
- Tree Type:
- In Columns section at the top, set:
- App - Column Renderer:
Hidden
- Requests - Column Renderer:
Bar
, Color:Blue
, Minimum Value:0
- App - Column Renderer:
- Click the Save and Close button at the bottom of the pane.