Query blocks are the core component of notebooks, allowing you to write NRQL queries and visualize the results within your document. You can add multiple query blocks to a single notebook to build a comprehensive data story.
Active block
The active block is the currently focused, interactive unit within your notebook. It serves as your immediate workspace for writing code, running queries, or adding documentation.
The active block is immediately visible, making it easy to spot within your notebook. It is identified by two key visual cues:
- Clear Borders: The active block is highlighted with a distinct, clear border color.
- Visible Toolbar: It is the only cell that displays the actions.
Queries coming from Data Explorer are added to the active block if the active block is of type query. If the active block is currently markdown, a new query block is added.
To change an active block you need to select or add another block in the notebook.
When a Markdown Block is active, it automatically enters editing mode featuring a two-column layout:
- Editing Column (Left): This is where you type and format your Markdown code.
- Live Preview Column (Right): This displays a real-time visual preview of your formatted documentation.
Action toolbar
To help you optimize your workspace and maintain a clean view, the notebooks interface features an action toolbar. It consolidates core query actions into a compact, icon-based menu and groups secondary controls into a dedicated Actions Menu.
Core actions (Top of the Query block)
These essential, frequently used actions are accessible at the top of the query block:
- Run query: This is now represented by a play icon and executes the current query.
- Recent queries: Allows you to quickly access and reuse your last 10 recently executed queries from your current session.
- Recommended queries: Provides suggestions for queries.
- Copy query link: Generates a shareable link to the current query.
Actions Menu (Secondary controls)
The Actions Menu houses additional, less frequently used, or organizational controls.
- Add another query: Inserts a new, empty query block into your notebook.
- Remove query: Deletes the query from multi-query TIMESERIES.
- PromQL translator: A utility for translating queries into PromQL (Prometheus Query Language).
- Clear: Removes the query from the query input.
- Create alert: Initiates the process for setting up a new alert based on the query results.
- Move up/down/to the top/to the bottom: Reorganizes the current query block's position within the notebook.
- Delete block: Deletes the active block.
Add a query block
To add a query block to your notebook:
- Open your notebook in the query console.
- Click + Query.
- Write your NRQL query in the query editor.
- Press Run or Enter to execute the query and display results.
Tip
All NRQL queries supported in the standard query builder work in notebook query blocks. You can query any data type including metrics, events, logs, and traces. All chart types and customizations available in the standard query builder are supported in notebooks.
Query block management
What's next?
- Return to Get started with notebooks for an overview
- Explore Dashboards for building persistent data visualizations
- Learn more about Chart types for visualization options