VariableModel🔗
A variable is a placeholder for a value. You can use variables in metric queries and in panel titles.
Definition🔗
type VariableModel struct {
// Type of variable
Type dashboard.VariableType `json:"type"`
// Name of variable
Name string `json:"name"`
// Optional display name
Label *string `json:"label,omitempty"`
// Visibility configuration for the variable
Hide *dashboard.VariableHide `json:"hide,omitempty"`
// Whether the variable value should be managed by URL query params or not
SkipUrlSync *bool `json:"skipUrlSync,omitempty"`
// Description of variable. It can be defined but `null`.
Description *string `json:"description,omitempty"`
// Query used to fetch values for a variable
Query *dashboard.StringOrMap `json:"query,omitempty"`
// Data source used to fetch values for a variable. It can be defined but `null`.
Datasource *dashboard.DataSourceRef `json:"datasource,omitempty"`
// Shows current selected variable text/value on the dashboard
Current *dashboard.VariableOption `json:"current,omitempty"`
// Whether multiple values can be selected or not from variable value list
Multi *bool `json:"multi,omitempty"`
// Options that can be selected for a variable.
Options []dashboard.VariableOption `json:"options,omitempty"`
// Options to config when to refresh a variable
Refresh *dashboard.VariableRefresh `json:"refresh,omitempty"`
// Options sort order
Sort *dashboard.VariableSort `json:"sort,omitempty"`
// Whether all value option is available or not
IncludeAll *bool `json:"includeAll,omitempty"`
// Custom all value
AllValue *string `json:"allValue,omitempty"`
// Optional field, if you want to extract part of a series name or metric node segment.
// Named capture groups can be used to separate the display text and value.
Regex *string `json:"regex,omitempty"`
// Dynamically calculates interval by dividing time range by the count specified.
Auto *bool `json:"auto,omitempty"`
// The minimum threshold below which the step count intervals will not divide the time.
AutoMin *string `json:"auto_min,omitempty"`
// How many times the current time range should be divided to calculate the value, similar to the Max data points query option.
// For example, if the current visible time range is 30 minutes, then the auto interval groups the data into 30 one-minute increments.
AutoCount *int32 `json:"auto_count,omitempty"`
}
Methods🔗
UnmarshalJSONStrict🔗
UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode VariableModel
from JSON.
Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …
Equals🔗
Equals tests the equality of two VariableModel
objects.
Validate🔗
Validate checks all the validation constraints that may be defined on VariableModel
fields for violations and returns them.