Interactive Workbooks
Workbooks allow authors to create interactive reports and experiences for their consumers. Interactivity is supported in a number of ways.
Parameter Changes
When a workbook user updates a parameter, any control that uses the parameter automatically refreshes and redraws to reflect the new state. This is how most of the Azure portal reports support interactivity. Workbooks provide this in a straight forward manner with minimal user effort.
Learn more about Parameters in Workbooks
Grid, tile, chart selections
Workbooks allow authors to construct scenarios where clicking a row in a grid updates subsequent charts based on the content of the row.
For instance, a user can have a grid that shows a list of requests and some stats like failure counts. They could set up it up such that clicking a row corresponding to a request, will result in detailed charts below updating to filter down to just that request.
Setting up interactivity on grid row click
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 (for example, Application Insights) and the resources to target.
Use the Query editor to enter the KQL for your analysis
requests | summarize AllRequests = count(), FailedRequests = countif(success == false) by Request = name | order by AllRequests desc
Run query
to see the resultsSelect the Advanced Settings icon on the query footer (the icon looks like a gear). This opens up the advanced settings pane.
Check the setting:
When an item is selected, export a parameter
.Under the setting you checked, select Add Parameter and fill it out with the information below.
- Field to export:
Request
- Parameter name:
SelectedRequest
- Default value:
All requests
- Field to export:
Select Save
Select
Done Editing
.Add another query control using steps 2 and 3.
Use the Query editor to enter the KQL for your analysis.
requests | where name == '{SelectedRequest}' or 'All Requests' == '{SelectedRequest}' | summarize ['{SelectedRequest}'] = count() by bin(timestamp, 1h)
Run query
to see the results.Change Visualization to
Area chart
.Choose a row to select in the first grid. Note how the area chart below filters to the selected request.
The resulting report looks like this in edit mode:
The image below shows a more elaborate interactive report in read mode based on the same principles. The report uses grid clicks to export parameters - which in turn is used in two charts and a text block.
Exporting the contents of an entire row
It is sometimes desirable to export the entire contents of the selected row instead of just a particular column. In such cases, leave the Field to export
property unset in step 7.1 above. Workbooks will export the entire row contents as a json to the parameter.
On the referencing KQL control, use the todynamic
function to parse the json and access the individual columns.
Grid Cell Clicks
Workbooks allow authors to add interactivity via a special type of grid column renderer called a link renderer
. A link renderer converts a grid cell into a hyperlink based on the contents of the cell. Workbooks support many kinds of link renderers - including ones that allow opening resource overview blades, property bag viewers, App Insights search, usage, transaction tracing, etc.
Setting up interactivity using grid cell clicks
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 (for example, Application Insights) and the resources to target.
Use the Query editor to enter the KQL for your analysis
requests | summarize Count = count(), Sample = any(pack_all()) by Request = name | order by Count desc
Run query
to see the resultsSelect Column Settings to open the settings pane.
In the Columns section, set:
- Sample - Column Renderer:
Link
, View to open:Cell Details
, Link Label:Sample
- Count - Column Renderer:
Bar
, Color palette:Blue
, Minimum value:0
- Request - Column Renderer:
Automatic
- Select Save and Close to apply changes
- Sample - Column Renderer:
Click on one of the
Sample
links in the grid. This opens up a pane with the details of a sampled request.
Link Renderer Actions
Link action | Action on click |
---|---|
Generic Details |
Shows the row values in a property grid context tab |
Cell Details |
Shows the cell value in a property grid context tab. Useful when the cell contains a dynamic type with information (for example, json with request properties like location, role instance, etc.). |
Cell Details |
Shows the cell value in a property grid context tab. Useful when the cell contains a dynamic type with information (for example, json with request properties like location, role instance, etc.). |
Custom Event Details |
Opens the Application Insights search details with the custom event ID (itemId ) in the cell |
* Details |
Similar to Custom Event Details, except for dependencies, exceptions, page views, requests, and traces. |
Custom Event User Flows |
Opens the Application Insights User Flows experience pivoted on the custom event name in the cell |
* User Flows |
Similar to Custom Event User Flows except for exceptions, page views and requests |
User Timeline |
Opens the user timeline with the user ID (user_Id) in the cell |
Session Timeline |
Opens the Application Insights search experience for the value in the cell (for example, search for text 'abc' where abc is the value in the cell) |
Resource overview |
Open the resource's overview in the portal based on the resource ID value in the cell |
Conditional Visibility
Workbook allows users to make certain controls appear or disappear based on values of the parameters. This allows authors to have reports look different based on user input or telemetry state. An example is showing consumers just a summary when things are good but show full details when something is wrong.
Setting up interactivity using conditional visibility
Follow the steps in the Setting up interactivity on grid row click section to set up two interactive controls.
Add a new parameter at the top:
- Name:
ShowDetails
- Parameter type:
Drop down
- Required:
checked
- Get data from:
JSON
- JSON Input:
["Yes", "No"]
- Save to commit changes.
- Name:
Set parameter value to
Yes
In the query control with the area chart, select the Advanced Settings icon (gear icon)
Check the setting
Make this item conditionally visible
- This item is visible if
ShowDetails
parameter valueequals
Yes
- This item is visible if
Select Done Editing to commit changes.
Select Done Editing on the workbook tool bar to enter read mode.
Switch the value of parameter
ShowDetails
toNo
. Notice that the chart below disappears.
The image below shows the visible case where ShowDetails
is Yes
The image below shows the hidden case where ShowDetails
is No
Interactivity with multiple selections in grids and charts
Query and metrics steps can also export one or more parameters when a row (or multiple rows) is selected.
- In the query step displaying the grid, go to the advanced settings.
- Check the
When items are selected, export parameters
checkbox. Additional controls will appear. - Check the
allow selection of multiple values
checkbox.- The displayed visualization will allow multi-select and exported parameter's values will be arrays of values, like when using multi-select dropdown parameters.
- If unchecked the display visualization will only respect the last selected item. Only exporting a single value at a time.
- For each parameter you wish to export, use the Add Parameter button. A popup window will appear, containing the settings for the parameter to be exported.
When single selection is enabled, the author can specify which field of the original data to export. Fields include parameter name, parameter type, and default value to use if nothing is selected (optional).
When multi-selection is enabled, the author specifies which field of the original data to export. Fields include parameter name, parameter type, quote with and delimiter. The quote with and delimiter values are used when turning the arrow values into text when being replaced in a query. In multi-select if no values are selected, then the default value is an empty array.
Note
For multi select, only unique values will be exported, you will not see output array values like " 1,1,2,1" you will get "1,2" as the output values.
You can leave the "Field to export" setting empty in the export settings. If you do, all the available fields in the data will be exported as a stringified JSON object of key:value pairs. For grids and titles, this will be all of the fields in the grid. For charts, the available fields will be x,y,series, and label (depending on the type of chart).
While the default behavior is to export a parameter as text, if you know that the field is a subscription or resource ID, use that as the export parameter type. This will allow the parameter to be used downstream in places that require those types of parameters.
Next steps
- Get started learning more about workbooks many rich visualizations options.
- Control and share access to your workbook resources.