|
| 1 | +--- |
| 2 | +title: "Query Workbench" |
| 3 | +description: "Run ad-hoc queries against Prometheus, Loki, VictoriaLogs, SLS, CLS, and SQL data sources in Flashduty Monitors. Supports graph, raw, and log volume views." |
| 4 | +keywords: ["Explore", "Query Workbench", "ad-hoc query", "Prometheus", "Loki", "data source"] |
| 5 | +--- |
| 6 | + |
| 7 | +The Query Workbench (Explore) is an ad-hoc query interface in Flashduty Monitors for running temporary queries against data sources without creating alert rules. It supports Prometheus, Loki, VictoriaLogs, Alibaba Cloud SLS, Tencent Cloud CLS, and MySQL, PostgreSQL, Oracle, ClickHouse, Elasticsearch data sources. |
| 8 | + |
| 9 | +## Access |
| 10 | + |
| 11 | +- **From the data source list**: Go to **Monitors → Data Sources** and click the "Query Workbench" entry on the target data source row. |
| 12 | +- **Direct URL**: Navigate to `/monit/explore` and select a data source in the page. |
| 13 | +- **From incident/alert labels**: In the label area of incident or alert detail, the "Explore" icon on query-type label rows opens the workbench with the alert's triggering query and time window pre-filled. |
| 14 | + |
| 15 | +## Query Types |
| 16 | + |
| 17 | +Different data sources support different query types, switched above the editor: |
| 18 | + |
| 19 | +| Data Source | Query Type | Description | |
| 20 | +|-------------|-----------|-------------| |
| 21 | +| Prometheus | Graph + Raw | Shows both a line chart and raw samples | |
| 22 | +| Prometheus | Graph only | Shows only the line chart (range query) | |
| 23 | +| Prometheus | Raw only | Shows only raw samples (instant query) | |
| 24 | +| Loki | Range | Returns log lines within the time range | |
| 25 | +| Loki | Instant | Returns matching log lines at the current moment | |
| 26 | +| VictoriaLogs | Raw logs | Returns raw log lines | |
| 27 | +| VictoriaLogs | Instant stats | Returns instant aggregate statistics | |
| 28 | +| VictoriaLogs | Range stats | Returns range trend statistics | |
| 29 | +| SLS / CLS | — | No query type selector; vendor-classified logs/tables | |
| 30 | +| MySQL / PostgreSQL / Oracle / ClickHouse / ES | — | SQL/query expression executed directly | |
| 31 | + |
| 32 | +## Result Display |
| 33 | + |
| 34 | +The result area auto-layouts based on data source and query type: |
| 35 | + |
| 36 | +- **Prometheus**: Split pane — line chart (Graph) on top, raw samples (Raw) below, with a draggable splitter. |
| 37 | +- **Other data sources**: Single result pane showing log view, table view, or samples view depending on the query type. |
| 38 | + |
| 39 | +### Graph Features |
| 40 | + |
| 41 | +- **Drag-to-zoom**: Drag-select a time range on the chart to zoom in. |
| 42 | +- **Legend facet filtering**: The legend area supports searching by label value and grouping by metric name. Series beyond the display limit are collapsed; click to expand. |
| 43 | +- **Tooltip**: Hover to see values for all series at a given time point. Series beyond the limit are summarized in the tooltip. |
| 44 | + |
| 45 | +### Log Time Distribution |
| 46 | + |
| 47 | +When the query type includes logs, a log time distribution chart appears above the result area: |
| 48 | + |
| 49 | +- Time range ≤ 24 hours: auto-loaded. |
| 50 | +- 24 hours – 30 days: requires manual click to load. |
| 51 | +- Beyond 30 days: not supported. |
| 52 | + |
| 53 | +## Query Parameters |
| 54 | + |
| 55 | +In addition to the query expression, some data sources support private parameters: |
| 56 | + |
| 57 | +| Parameter | Data Sources | Description | |
| 58 | +|-----------|-------------|-------------| |
| 59 | +| Limit | Loki / VictoriaLogs | Caps the number of returned rows | |
| 60 | +| Min step (seconds) | Prometheus | Lower bound for auto step calculation | |
| 61 | +| Direction | Loki / VictoriaLogs | Latest-first or earliest-first | |
| 62 | +| Project / Logstore | SLS | Required; used in the request URL | |
| 63 | +| Region / Topic / Syntax | Tencent CLS | Required | |
| 64 | +| PowerSQL | SLS | Enables PowerSQL mode | |
| 65 | +| Time macros | SQL data sources | `$__timeFilter(column)`, `$__timeFrom()`, `$__timeTo()` make the time range take effect | |
| 66 | + |
| 67 | +## Query History |
| 68 | + |
| 69 | +Each successful query is automatically saved to query history, which stores only the query expression — not the time range or results. History is isolated per data source, stored in the browser locally, and retains up to 200 entries. When the limit is exceeded, the oldest entry is evicted. Oversized query expressions are not saved to history but the query itself still succeeds. You can delete individual entries or clear all history for the current data source from the history panel. |
| 70 | + |
| 71 | +## Sharing and URL State |
| 72 | + |
| 73 | +The workbench encodes the current data source, query expression, time range, and query type into URL parameters. Copy the browser address bar to share the current query state — opening the link restores it automatically. If the data source in the link doesn't exist, is disabled, or the user lacks permissions, the page prompts and does not auto-execute. |
| 74 | + |
| 75 | +## Edge Version Requirements |
| 76 | + |
| 77 | +The Query Workbench relies on monit-edge to execute queries. If the Edge version in the data source's cluster is too low or versions are mixed, the page shows an upgrade prompt and disables querying. All Edge instances in the cluster must be upgraded to the required version before use. |
0 commit comments