From 951876b46562f9a64c1e4ae0c5007738fc84e372 Mon Sep 17 00:00:00 2001 From: Brendan O'Handley Date: Mon, 11 Sep 2023 12:13:16 -0400 Subject: [PATCH] Prometheus: Add classic query option to variable query editor (#74060) * add classic query to variable query editor * copy fixes * update test --- .../prometheus/template-variables/index.md | 15 +++-- .../components/VariableQueryEditor.test.tsx | 36 +++++++++- .../components/VariableQueryEditor.tsx | 66 ++++++++++++++++--- .../migrations/variableMigration.ts | 4 +- .../plugins/datasource/prometheus/types.ts | 2 + 5 files changed, 103 insertions(+), 20 deletions(-) diff --git a/docs/sources/datasources/prometheus/template-variables/index.md b/docs/sources/datasources/prometheus/template-variables/index.md index 5e4c66520cd..3085d3dcf5f 100644 --- a/docs/sources/datasources/prometheus/template-variables/index.md +++ b/docs/sources/datasources/prometheus/template-variables/index.md @@ -31,13 +31,14 @@ You have the option to use several different variable types, but variables of th Select a Prometheus data source query type and enter the required inputs: -| Query Type | Input(\* required) | Description | Used API endpoints | -| -------------- | ------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------- | -| `Label names` | `metric` | Returns a list of all label names matching the specified `metric` regex. | /api/v1/labels | -| `Label values` | `label`\*, `metric` | Returns a list of label values for the `label` in all metrics or the optional metric. | /api/v1/label/`label`/values or /api/v1/series | -| `Metrics` | `metric` | Returns a list of metrics matching the specified `metric` regex. | /api/v1/label/\_\_name\_\_/values | -| `Query result` | `query` | Returns a list of Prometheus query result for the `query`. | /api/v1/query | -| `Series query` | `metric`, `label` or both | Returns a list of time series associated with the entered data. | /api/v1/series | +| Query Type | Input(\* required) | Description | Used API endpoints | +| --------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | +| `Label names` | `metric` | Returns a list of all label names matching the specified `metric` regex. | /api/v1/labels | +| `Label values` | `label`\*, `metric` | Returns a list of label values for the `label` in all metrics or the optional metric. | /api/v1/label/`label`/values or /api/v1/series | +| `Metrics` | `metric` | Returns a list of metrics matching the specified `metric` regex. | /api/v1/label/\_\_name\_\_/values | +| `Query result` | `query` | Returns a list of Prometheus query result for the `query`. | /api/v1/query | +| `Series query` | `metric`, `label` or both | Returns a list of time series associated with the entered data. | /api/v1/series | +| `Classic query` | classic query string | Deprecated, classic version of variable query editor. Enter a string with the query type using a syntax like the following: `label_values(,