Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
variables
The available variable types described in the following sections:
- QueryVariableKind
- TextVariableKind
- ConstantVariableKind
- DatasourceVariableKind
- IntervalVariableKind
- CustomVariableKind
- GroupByVariableKind
- AdhocVariableKind
QueryVariableKind
Following is the JSON for a default query variable:
"variables": [
{
"kind": "QueryVariable",
"spec": {
"current": {
"text": "",
"value": ""
},
"hide": "dontHide",
"includeAll": false,
"multi": false,
"name": "",
"options": [],
"query": defaultDataQueryKind(),
"refresh": "never",
"regex": "",
"skipUrlSync": false,
"sort": "disabled"
}
}
]QueryVariableKind consists of:
- kind: “QueryVariable”
- spec: QueryVariableSpec
QueryVariableSpec
The following table explains the usage of the query variable JSON fields:
VariableOption
DataSourceRef
TextVariableKind
Following is the JSON for a default text variable:
"variables": [
{
"kind": "TextVariable",
"spec": {
"current": {
"text": "",
"value": ""
},
"hide": "dontHide",
"name": "",
"query": "",
"skipUrlSync": false
}
}
]TextVariableKind consists of:
- kind: TextVariableKind
- spec: TextVariableSpec
TextVariableSpec
The following table explains the usage of the query variable JSON fields:
ConstantVariableKind
Following is the JSON for a default constant variable:
"variables": [
{
"kind": "ConstantVariable",
"spec": {
"current": {
"text": "",
"value": ""
},
"hide": "hideVariable",
"name": "",
"query": "",
"skipUrlSync": true
}
}
]ConstantVariableKind consists of:
- kind: “ConstantVariable”
- spec: ConstantVariableSpec
ConstantVariableSpec
The following table explains the usage of the constant variable JSON fields:
DatasourceVariableKind
Following is the JSON for a default data source variable:
"variables": [
{
"kind": "DatasourceVariable",
"spec": {
"current": {
"text": "",
"value": ""
},
"hide": "dontHide",
"includeAll": false,
"multi": false,
"name": "",
"options": [],
"pluginId": "",
"refresh": "never",
"regex": "",
"skipUrlSync": false
}
}
]DatasourceVariableKind consists of:
- kind: “DatasourceVariable”
- spec: DatasourceVariableSpec
DatasourceVariableSpec
The following table explains the usage of the data source variable JSON fields:
IntervalVariableKind
Following is the JSON for a default interval variable:
"variables": [
{
"kind": "IntervalVariable",
"spec": {
"auto": false,
"auto_count": 0,
"auto_min": "",
"current": {
"text": "",
"value": ""
},
"hide": "dontHide",
"name": "",
"options": [],
"query": "",
"refresh": "never",
"skipUrlSync": false
}
}
]IntervalVariableKind consists of:
- kind: “IntervalVariable”
- spec: IntervalVariableSpec
IntervalVariableSpec
The following table explains the usage of the interval variable JSON fields:
CustomVariableKind
Following is the JSON for a default custom variable:
"variables": [
{
"kind": "CustomVariable",
"spec": {
"current": defaultVariableOption(),
"hide": "dontHide",
"includeAll": false,
"multi": false,
"name": "",
"options": [],
"query": "",
"skipUrlSync": false
}
}
]CustomVariableKind consists of:
- kind: “CustomVariable”
- spec: CustomVariableSpec
CustomVariableSpec
The following table explains the usage of the custom variable JSON fields:
GroupByVariableKind
Following is the JSON for a default group by variable:
"variables": [
{
"kind": "GroupByVariable",
"spec": {
"current": {
"text": [
""
],
"value": [
""
]
},
"datasource": {},
"hide": "dontHide",
"multi": false,
"name": "",
"options": [],
"skipUrlSync": false
}
}
]GroupByVariableKind consists of:
- kind: “GroupByVariable”
- spec: GroupByVariableSpec
GroupByVariableSpec
The following table explains the usage of the group by variable JSON fields:
AdhocVariableKind
Following is the JSON for a default ad hoc variable:
"variables": [
{
"kind": "AdhocVariable",
"spec": {
"baseFilters": [],
"defaultKeys": [],
"filters": [],
"hide": "dontHide",
"name": "",
"skipUrlSync": false
}
}
]AdhocVariableKind consists of:
- kind: “AdhocVariable”
- spec: AdhocVariableSpec
AdhocVariableSpec
The following table explains the usage of the ad hoc variable JSON fields:
AdHocFiltersWithLabels
The following table explains the usage of the ad hoc variable with labels JSON fields:
MetricFindValue
The following table explains the usage of the metric find value JSON fields:



