[v9.5.x] update prometheus template variables doc (#69414)
update prometheus template variables doc (#69335)
* edits for clarity
* added 2 new sections on query variable options
* Update docs/sources/datasources/prometheus/template-variables/index.md
Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
---------
Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
(cherry picked from commit 5ac56bcb28)
Co-authored-by: lwandz13 <126723338+lwandz13@users.noreply.github.com>
This commit is contained in:
co-authored by
lwandz13
parent
a1d66bf368
commit
2b84887e50
@@ -15,15 +15,14 @@ weight: 400
|
||||
|
||||
# Prometheus template variables
|
||||
|
||||
Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables.
|
||||
Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. Grafana refers to such variables as **template** variables.
|
||||
Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed in your dashboard.
|
||||
Grafana refers to such variables as template variables.
|
||||
|
||||
For an introduction to templating and template variables, refer to the [Templating]({{< relref "../../../dashboards/variables" >}}) and [Add and manage variables]({{< relref "../../../dashboards/variables/add-template-variables" >}}) documentation.
|
||||
For an introduction to templating and template variables, see [Templating]({{< relref "../../../dashboards/variables" >}}) and [Add and manage variables]({{< relref "../../../dashboards/variables/add-template-variables" >}}).
|
||||
|
||||
## Use query variables
|
||||
|
||||
Use variables of the type _Query_ to query Prometheus for a list of metrics, labels, or label values.
|
||||
You have the option to use several different variable types, but variables of the type `Query` will query Prometheus for a list of metrics, labels, label values, a query result or a series.
|
||||
|
||||
Select a Prometheus data source query type and enter the required inputs:
|
||||
|
||||
@@ -37,6 +36,26 @@ Select a Prometheus data source query type and enter the required inputs:
|
||||
|
||||
For details on _metric names_, _label names_, and _label values_, refer to the [Prometheus documentation](http://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
|
||||
|
||||
### Query options
|
||||
|
||||
Under the query variable type, you can set the following query options:
|
||||
|
||||
| Option | Description |
|
||||
| --------------------- | ------------------------------------------------------------------------------------------------------- |
|
||||
| **Data source** | Select your data source from the dropdown list. |
|
||||
| **Select query type** | Options are `default`, `value` and `metric name`. Each query type hits a different Prometheus endpoint. |
|
||||
| **Regex** | Optional, if you want to extract part of a series name or metric node segment. |
|
||||
| **Sort** | Default is `disabled`. Options include `alphabetical`, `numerical` and `alphabetical case-sensitive`. |
|
||||
| **Refresh** | When to update the values for the variable. Options are `On dashboard load` and `On time range change`. |
|
||||
|
||||
### Selection options
|
||||
|
||||
The following selection options are available:
|
||||
|
||||
- **Multi-value** - Check this option to enable multiple values to be selected at the same time.
|
||||
|
||||
- **Include All option** - Check this option to include all variables.
|
||||
|
||||
### Use interval and range variables
|
||||
|
||||
You can use some global built-in variables in query variables, for example, `$__interval`, `$__interval_ms`, `$__range`, `$__range_s` and `$__range_ms`.
|
||||
|
||||
Reference in New Issue
Block a user