Build Queries
Each panel in a dashboard is powered by one or more queries against a data source. The query language depends on the signal type you are querying.
| Signal | Query language | Example use |
|---|---|---|
| Metrics | PromQL | CPU usage, request rate, error rate |
| Logs | LogQL | Filter and aggregate log lines |
| Traces | TraceQL | Search spans by duration, status, or attribute |
Write a query in the panel editor
Step 1 - Open a panel in edit mode (hover the panel and press E, or select Edit from the panel menu). On a read-only dashboard, click Make editable first.
Step 2 - On the Queries tab, select your Data source from the drop-down.
Step 3 - Build your query with the Builder, or switch to Code to write it directly (PromQL, LogQL, or TraceQL). OpsPilot provides syntax hints and auto-complete.
Step 4 - Click Run queries to run it and preview the results in the panel above.
Step 5 - Click Save dashboard to keep your changes. Back to dashboard returns without saving.
Multiple queries per panel
You can add more than one query to a single panel. Each query returns a separate series or dataset, and all results are rendered together in the visualization.
Click + Add query below the existing query to add another.
Tip
Use query aliases (the Legend field) to give each series a meaningful label in the panel legend.
Switching data sources
The data source can be changed at any time from within the panel editor:
Step 1 - Open the panel in edit mode.
Step 2 - In the Query tab, click the data source drop-down and select a different source.
The query field resets to match the new data source's query language.
Further reading
Need more help?
Contact support in the chat bubble and let us know how we can assist.