Skip to content

Commit b79c475

Browse files
Fixed review comments
1 parent 002350c commit b79c475

File tree

3 files changed

+155
-173
lines changed

3 files changed

+155
-173
lines changed
Lines changed: 60 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,67 @@
11
---
2-
title: Add queries to notebooks
2+
title: Blocks in notebook
33
tags:
44
- Query your data
55
- Explore and query data
66
- Notebooks
77
- NRQL
8-
translate:
9-
- jp
10-
- kr
11-
metaDescription: 'Learn how to add NRQL queries to your New Relic notebooks, customize query blocks, and visualize your data within notebook documents.'
8+
metaDescription: 'Learn about notebook blocks, active blocks, action toolbars, and how to add and manage query blocks in your New Relic notebooks.'
129
freshnessValidatedDate: never
1310
---
1411

1512
Query blocks are the core component of notebooks, allowing you to write NRQL queries and visualize the results directly within your document. You can add multiple query blocks to a single notebook to build a comprehensive data story.
1613

17-
## Add a query block
14+
## Active block
1815

19-
To add a query block to your notebook:
16+
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.
2017

21-
1. Open your notebook in the query console.
22-
2. Click the **+ Query** button or press **Ctrl+Enter** (or **Cmd+Enter** on Mac) to add a new query block.
23-
3. Write your NRQL query in the query editor.
24-
4. Press **Run** or **Enter** to execute the query and display results.
18+
The active block is immediately visible, making it easy to spot within your notebook. It is identified by two key visual cues:
19+
* **Clear Borders**: The active block is highlighted with a distinct, clear border color.
20+
* **Visible Toolbar**: It is the only cell that displays the actions.
2521

26-
<Callout variant="tip">
27-
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.
28-
</Callout>
29-
30-
## Write NRQL queries
31-
32-
Notebook query blocks support the full range of NRQL (New Relic Query Language) functionality:
22+
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.
3323

34-
### Basic queries
24+
To change an active block you need to select or add another block in the notebook.
3525

36-
```sql
37-
SELECT count(*) FROM Transaction
38-
WHERE appName = 'MyApp'
39-
SINCE 1 hour ago
40-
```
26+
When a Markdown Block is active, it automatically enters an editing mode featuring a convenient two-column layout to optimize your documentation workflow:
27+
* **Editing Column (Left)**: This is where you directly type and format your Markdown code.
28+
* **Live Preview Column (Right)**: This instantly displays a real-time visual preview of your formatted documentation, ensuring accuracy as you type.
4129

42-
### Complex aggregations
30+
## Action toolbar
4331

44-
```sql
45-
SELECT average(duration), percentile(duration, 95)
46-
FROM Transaction
47-
WHERE appName = 'MyApp'
48-
FACET name
49-
SINCE 1 day ago
50-
LIMIT 10
51-
```
32+
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.
5233

53-
### Time series data
34+
### Core actions (Top of the Query block)
5435

55-
```sql
56-
SELECT count(*) FROM Transaction
57-
WHERE appName = 'MyApp'
58-
TIMESERIES 5 minutes
59-
SINCE 6 hours ago
60-
```
36+
These essential, frequently used actions are directly accessible at the top of the query block via intuitive icons:
37+
* **Run query**: This is now represented by a play icon and executes the current query.
38+
* **Recent queries**: Allows you to quickly access and reuse recently executed queries.
39+
* **Recommended queries**: Provides suggestions for queries.
40+
* **Copy query link**: Generates a shareable link to the current query.
6141

62-
## Customize query visualizations
42+
### Actions Menu (Secondary controls)
6343

64-
Each query block supports all the visualization options available in the standard query builder:
44+
The Actions Menu houses additional, less frequently used, or organizational controls to keep your main toolbar uncluttered.
45+
* **Add another query**: Inserts a new, empty query block into your notebook.
46+
* **Remove query**: Deletes the query from multi-query TIMESERIES.
47+
* **PromQL translator**: A utility for translating queries into PromQL (Prometheus Query Language).
48+
* **Clear**: Removes the query from the query input.
49+
* **Create alert**: Initiates the process for setting up a new alert based on the query results.
50+
* **Move up/down/to the top/to the bottom**: Reorganizes the current query block's position within the notebook.
51+
* **Delete block**: Deletes the active block.
6552

66-
### Chart types
53+
## Add a query block
6754

68-
* **Line charts**: Perfect for time series data and trends
69-
* **Area charts**: Show volume and composition over time
70-
* **Bar charts**: Compare values across categories
71-
* **Pie charts**: Display proportional data
72-
* **Tables**: Show detailed data in rows and columns
73-
* **Billboards**: Highlight single important metrics
55+
To add a query block to your notebook:
7456

75-
### Chart customization
57+
1. Open your notebook in the query console.
58+
2. Click the **+ Query** button or press **Ctrl+Enter** (or **Cmd+Enter** on Mac) to add a new query block.
59+
3. Write your [NRQL query](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/) in the query editor.
60+
4. Press **Run** or **Enter** to execute the query and display results.
7661

77-
1. Click the **Chart type** dropdown above your query results.
78-
2. Select your preferred visualization.
79-
3. Use the **Chart settings** to customize:
80-
* Colors and styling
81-
* Axis labels and ranges
82-
* Data formatting
83-
* Thresholds and alerts
62+
<Callout variant="tip">
63+
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](https://docs.newrelic.com/docs/query-your-data/explore-query-data/use-charts/chart-types/) and customizations available in the standard query builder are supported in notebooks.
64+
</Callout>
8465

8566
## Use variables in queries
8667

@@ -108,13 +89,22 @@ SINCE {{timeRange}}
10889

10990
## Query block management
11091

111-
### Duplicate a query block
92+
<CollapserGroup>
93+
<Collapser
94+
id="duplicate-query-block"
95+
title="Duplicate a query block"
96+
>
11297

11398
1. Hover over the query block.
11499
2. Click the **three-dot menu** in the top-right corner.
115100
3. Select **Duplicate**.
116101

117-
### Move query blocks
102+
</Collapser>
103+
104+
<Collapser
105+
id="move-query-blocks"
106+
title="Move query blocks"
107+
>
118108

119109
Reorder your query blocks to improve your narrative flow:
120110

@@ -126,64 +116,23 @@ Reorder your query blocks to improve your narrative flow:
126116
* **Move to top**
127117
* **Move to bottom**
128118

129-
### Delete a query block
119+
</Collapser>
120+
121+
<Collapser
122+
id="delete-query-block"
123+
title="Delete a query block"
124+
>
130125

131126
1. Hover over the query block.
132127
2. Click the **three-dot menu**.
133128
3. Select **Delete**.
134129
4. Confirm the deletion.
135130

136-
## Query performance tips
137-
138-
To ensure your notebooks load quickly and perform well:
139-
140-
### Optimize query time ranges
141-
142-
* Use specific time ranges instead of open-ended queries
143-
* Consider using `SINCE` and `UNTIL` clauses for historical analysis
144-
* Use `LIMIT` to restrict result sets when appropriate
145-
146-
### Use efficient NRQL patterns
147-
148-
```sql
149-
-- Good: Efficient aggregation
150-
SELECT count(*) FROM Transaction
151-
WHERE appName = 'MyApp' AND duration > 1.0
152-
SINCE 1 hour ago
153-
154-
-- Avoid: Overly broad queries without filters
155-
SELECT * FROM Transaction
156-
SINCE 1 week ago
157-
```
158-
159-
### Cache query results
160-
161-
Query results in notebooks are cached for a short period. If you're iterating on analysis, you can rely on cached results to speed up notebook loading.
162-
163-
## Troubleshooting queries
164-
165-
### Common query errors
166-
167-
**Syntax errors**: Check your NRQL syntax using the [NRQL reference](/docs/nrql/nrql-syntax-clauses-functions).
168-
169-
**Data not found**: Verify:
170-
* Your time range includes data
171-
* Attribute names are spelled correctly
172-
* You have access to the data source
173-
174-
**Performance issues**:
175-
* Add more specific `WHERE` clauses
176-
* Reduce the time range
177-
* Use `LIMIT` to restrict results
178-
179-
### Get help with NRQL
180-
181-
* Browse [NRQL examples](/docs/nrql/nrql-examples) for common patterns
182-
* Check the [NRQL tutorial](/docs/nrql/nrql-tutorials) for learning resources
183-
* Use the [query builder](/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder) to build queries visually
131+
</Collapser>
132+
</CollapserGroup>
184133

185134
## What's next?
186135

187-
* Learn about [visualizations in notebooks](/docs/query-your-data/explore-query-data/notebooks/visualizations-in-notebooks)
188-
* Discover how to [share notebooks](/docs/query-your-data/explore-query-data/notebooks/share-notebooks) with your team
189-
* Explore [notebook examples](/docs/query-your-data/explore-query-data/notebooks/notebooks-examples) for inspiration
136+
* Return to [Get started with notebooks](/docs/query-your-data/explore-query-data/notebooks/introduction-notebooks) for an overview
137+
* Explore [Dashboards](/docs/query-your-data/explore-query-data/dashboards/introduction-dashboards) for building persistent data visualizations
138+
* Learn more about [Chart types](/docs/query-your-data/explore-query-data/use-charts/chart-types) for visualization options

0 commit comments

Comments
 (0)