Documentation
¶
Index ¶
- Constants
- type AnnotationQuery
- type AnnotationTarget
- type CursorSync
- type Dashboard
- type DataSourceRef
- type DataTransformerConfig
- type DynamicConfigValue
- type FieldColor
- type FieldColorModeId
- type FieldColorSeriesByMode
- type FieldConfig
- type FieldConfigSource
- type GraphPanel
- type GraphPanelType
- type GridPos
- type HeatmapPanel
- type HeatmapPanelType
- type Kind
- type LibraryPanelRef
- type Link
- type LinkType
- type LoadingState
- type MappingType
- type MatcherConfig
- type Panel
- type PanelRepeatDirection
- type RangeMap
- type RangeMapType
- type RegexMap
- type RegexMapType
- type RowPanel
- type RowPanelType
- type Snapshot
- type SpecialValueMap
- type SpecialValueMapOptionsMatch
- type SpecialValueMapType
- type SpecialValueMatch
- type Style
- type Target
- type Threshold
- type ThresholdsConfig
- type ThresholdsMode
- type ValueMap
- type ValueMapType
- type ValueMappingResult
- type VariableHide
- type VariableModel
- type VariableType
Constants ¶
const HandoffSchemaVersion = 36
HandoffSchemaVersion is the minimum schemaVersion for dashboards at which the Thema-based dashboard schema is possibly valid
schemaVersion is the original version numbering system for dashboards. If a dashboard is below this schemaVersion, it is necessary for the frontend typescript dashboard migration logic to first run and get it past this number, after which Thema can take over.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnotationQuery ¶
type AnnotationQuery struct { BuiltIn int `json:"builtIn"` // Datasource to use for annotation. Datasource struct { Type *string `json:"type,omitempty"` Uid *string `json:"uid,omitempty"` } `json:"datasource"` // Whether annotation is enabled. Enable bool `json:"enable"` // Whether to hide annotation. Hide *bool `json:"hide,omitempty"` // Annotation icon color. IconColor *string `json:"iconColor,omitempty"` // Name of annotation. Name *string `json:"name,omitempty"` // Query for annotation data. RawQuery *string `json:"rawQuery,omitempty"` ShowIn int `json:"showIn"` // TODO docs Target *AnnotationTarget `json:"target,omitempty"` Type string `json:"type"` }
TODO docs FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
type AnnotationTarget ¶
type AnnotationTarget struct { Limit int64 `json:"limit"` MatchAny bool `json:"matchAny"` Tags []string `json:"tags"` Type string `json:"type"` }
TODO docs
type CursorSync ¶
type CursorSync int
0 for no shared crosshair or tooltip (default). 1 for shared crosshair. 2 for shared crosshair AND shared tooltip.
const ( CursorSyncN0 CursorSync = 0 CursorSyncN1 CursorSync = 1 CursorSyncN2 CursorSync = 2 )
Defines values for CursorSync.
type Dashboard ¶
type Dashboard struct { // TODO docs Annotations *struct { List []AnnotationQuery `json:"list,omitempty"` } `json:"annotations,omitempty"` // Description of dashboard. Description *string `json:"description,omitempty"` // Whether a dashboard is editable or not. Editable bool `json:"editable"` // The month that the fiscal year starts on. 0 = January, 11 = December FiscalYearStartMonth *int `json:"fiscalYearStartMonth,omitempty"` // For dashboards imported from the https://grafana.com/grafana/dashboards/ portal GnetId *string `json:"gnetId,omitempty"` // 0 for no shared crosshair or tooltip (default). // 1 for shared crosshair. // 2 for shared crosshair AND shared tooltip. GraphTooltip CursorSync `json:"graphTooltip"` // Unique numeric identifier for the dashboard. // TODO must isolate or remove identifiers local to a Grafana instance...? Id *int64 `json:"id,omitempty"` // TODO docs Links []Link `json:"links,omitempty"` // When set to true, the dashboard will redraw panels at an interval matching the pixel width. // This will keep data "moving left" regardless of the query refresh rate. This setting helps // avoid dashboards presenting stale live data LiveNow *bool `json:"liveNow,omitempty"` Panels []interface{} `json:"panels,omitempty"` // Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". Refresh *interface{} `json:"refresh,omitempty"` // This property should only be used in dashboards defined by plugins. It is a quick check // to see if the version has changed since the last time. Unclear why using the version property // is insufficient. Revision *int64 `json:"revision,omitempty"` // Version of the JSON schema, incremented each time a Grafana update brings // changes to said schema. // TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion SchemaVersion int `json:"schemaVersion"` // TODO docs Snapshot *Snapshot `json:"snapshot,omitempty"` // Theme of dashboard. Style Style `json:"style"` // Tags associated with dashboard. Tags []string `json:"tags,omitempty"` // TODO docs Templating *struct { List []VariableModel `json:"list,omitempty"` } `json:"templating,omitempty"` // Time range for dashboard, e.g. last 6 hours, last 7 days, etc Time *struct { From string `json:"from"` To string `json:"to"` } `json:"time,omitempty"` // TODO docs // TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes Timepicker *struct { // Whether timepicker is collapsed or not. Collapse bool `json:"collapse"` // Whether timepicker is enabled or not. Enable bool `json:"enable"` // Whether timepicker is visible or not. Hidden bool `json:"hidden"` // Selectable intervals for auto-refresh. RefreshIntervals []string `json:"refresh_intervals"` // TODO docs TimeOptions []string `json:"time_options"` } `json:"timepicker,omitempty"` // Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc". Timezone *string `json:"timezone,omitempty"` // Title of dashboard. Title *string `json:"title,omitempty"` // Unique dashboard identifier that can be generated by anyone. string (8-40) Uid *string `json:"uid,omitempty"` // Version of the dashboard, incremented each time the dashboard is updated. Version *int `json:"version,omitempty"` // TODO docs WeekStart *string `json:"weekStart,omitempty"` }
Dashboard defines model for Dashboard.
type DataSourceRef ¶
type DataSourceRef struct { // The plugin type-id Type *string `json:"type,omitempty"` // Specific datasource instance Uid *string `json:"uid,omitempty"` }
Ref to a DataSource instance
type DataTransformerConfig ¶
type DataTransformerConfig struct { // Disabled transformations are skipped Disabled *bool `json:"disabled,omitempty"` Filter *MatcherConfig `json:"filter,omitempty"` // Unique identifier of transformer Id string `json:"id"` // Options to be passed to the transformer // Valid options depend on the transformer id Options interface{} `json:"options"` }
TODO docs
type DynamicConfigValue ¶
type DynamicConfigValue struct { Id string `json:"id"` Value *interface{} `json:"value,omitempty"` }
DynamicConfigValue defines model for DynamicConfigValue.
type FieldColor ¶
type FieldColor struct { // Stores the fixed color value if mode is fixed FixedColor *string `json:"fixedColor,omitempty"` // The main color scheme mode Mode string `json:"mode"` // TODO docs SeriesBy *FieldColorSeriesByMode `json:"seriesBy,omitempty"` }
TODO docs
type FieldColorModeId ¶
type FieldColorModeId string
TODO docs
const ( FieldColorModeIdContinuousGrYlRd FieldColorModeId = "continuous-GrYlRd" FieldColorModeIdFixed FieldColorModeId = "fixed" FieldColorModeIdPaletteClassic FieldColorModeId = "palette-classic" FieldColorModeIdPaletteSaturated FieldColorModeId = "palette-saturated" FieldColorModeIdThresholds FieldColorModeId = "thresholds" )
Defines values for FieldColorModeId.
type FieldColorSeriesByMode ¶
type FieldColorSeriesByMode string
TODO docs
const ( FieldColorSeriesByModeLast FieldColorSeriesByMode = "last" FieldColorSeriesByModeMax FieldColorSeriesByMode = "max" FieldColorSeriesByModeMin FieldColorSeriesByMode = "min" )
Defines values for FieldColorSeriesByMode.
type FieldConfig ¶
type FieldConfig struct { // TODO docs Color *FieldColor `json:"color,omitempty"` // custom is specified by the PanelFieldConfig field // in panel plugin schemas. Custom map[string]interface{} `json:"custom,omitempty"` // Significant digits (for display) Decimals *float32 `json:"decimals,omitempty"` // Human readable field metadata Description *string `json:"description,omitempty"` // The display value for this field. This supports template variables blank is auto DisplayName *string `json:"displayName,omitempty"` // This can be used by data sources that return and explicit naming structure for values and labels // When this property is configured, this value is used rather than the default naming strategy. DisplayNameFromDS *string `json:"displayNameFromDS,omitempty"` // True if data source field supports ad-hoc filters Filterable *bool `json:"filterable,omitempty"` // The behavior when clicking on a result Links []interface{} `json:"links,omitempty"` // Convert input values into a display string Mappings []interface{} `json:"mappings,omitempty"` Max *float32 `json:"max,omitempty"` Min *float32 `json:"min,omitempty"` // Alternative to empty string NoValue *string `json:"noValue,omitempty"` // An explicit path to the field in the datasource. When the frame meta includes a path, // This will default to `${frame.meta.path}/${field.name} // // When defined, this value can be used as an identifier within the datasource scope, and // may be used to update the results Path *string `json:"path,omitempty"` Thresholds *ThresholdsConfig `json:"thresholds,omitempty"` // Numeric Options Unit *string `json:"unit,omitempty"` // True if data source can write a value to the path. Auth/authz are supported separately Writeable *bool `json:"writeable,omitempty"` }
FieldConfig defines model for FieldConfig.
type FieldConfigSource ¶
type FieldConfigSource struct { Defaults FieldConfig `json:"defaults"` Overrides []struct { Matcher MatcherConfig `json:"matcher"` Properties []DynamicConfigValue `json:"properties"` } `json:"overrides"` }
FieldConfigSource defines model for FieldConfigSource.
type GraphPanel ¶
type GraphPanel struct { // @deprecated this is part of deprecated graph panel Legend *struct { Show bool `json:"show"` Sort *string `json:"sort,omitempty"` SortDesc *bool `json:"sortDesc,omitempty"` } `json:"legend,omitempty"` Type GraphPanelType `json:"type"` }
Support for legacy graph and heatmap panels.
type GraphPanelType ¶
type GraphPanelType string
GraphPanelType defines model for GraphPanel.Type.
const (
GraphPanelTypeGraph GraphPanelType = "graph"
)
Defines values for GraphPanelType.
type GridPos ¶
type GridPos struct { // H Panel H int `json:"h"` // Static true if fixed Static *bool `json:"static,omitempty"` // W Panel W int `json:"w"` // Panel x X int `json:"x"` // Panel y Y int `json:"y"` }
GridPos defines model for GridPos.
type HeatmapPanel ¶
type HeatmapPanel struct {
Type HeatmapPanelType `json:"type"`
}
HeatmapPanel defines model for HeatmapPanel.
type HeatmapPanelType ¶
type HeatmapPanelType string
HeatmapPanelType defines model for HeatmapPanel.Type.
const (
HeatmapPanelTypeHeatmap HeatmapPanelType = "heatmap"
)
Defines values for HeatmapPanelType.
type Kind ¶
TODO standard generated docs
func (*Kind) ConvergentLineage ¶
func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Dashboard]
ConvergentLineage returns the same thema.Lineage as Lineage, but bound (see thema.BindType) to the the Dashboard type generated from the current schema, v0.0.
func (*Kind) JSONValueMux ¶
JSONValueMux is a version multiplexer that maps a []byte containing JSON data at any schematized dashboard version to an instance of Dashboard.
Validation and translation errors emitted from this func will identify the input bytes as "dashboard.json".
This is a thin wrapper around Thema's vmux.ValueMux.
type LibraryPanelRef ¶
LibraryPanelRef defines model for LibraryPanelRef.
type Link ¶
type Link struct { AsDropdown bool `json:"asDropdown"` Icon string `json:"icon"` IncludeVars bool `json:"includeVars"` KeepTime bool `json:"keepTime"` Tags []string `json:"tags"` TargetBlank bool `json:"targetBlank"` Title string `json:"title"` Tooltip string `json:"tooltip"` // TODO docs Type LinkType `json:"type"` Url string `json:"url"` }
FROM public/app/features/dashboard/state/Models.ts - ish TODO docs
type LoadingState ¶
type LoadingState string
LoadingState defines model for LoadingState.
const ( LoadingStateDone LoadingState = "Done" LoadingStateError LoadingState = "Error" LoadingStateLoading LoadingState = "Loading" LoadingStateNotStarted LoadingState = "NotStarted" LoadingStateStreaming LoadingState = "Streaming" )
Defines values for LoadingState.
type MappingType ¶
type MappingType string
TODO docs
const ( MappingTypeRange MappingType = "range" MappingTypeRegex MappingType = "regex" MappingTypeSpecial MappingType = "special" MappingTypeValue MappingType = "value" )
Defines values for MappingType.
type MatcherConfig ¶
type MatcherConfig struct { Id string `json:"id"` Options *interface{} `json:"options,omitempty"` }
MatcherConfig defines model for MatcherConfig.
type Panel ¶
type Panel struct { // The datasource used in all targets. Datasource *struct { Type *string `json:"type,omitempty"` Uid *string `json:"uid,omitempty"` } `json:"datasource,omitempty"` // Description Description. Description *string `json:"description,omitempty"` FieldConfig FieldConfigSource `json:"fieldConfig"` GridPos *GridPos `json:"gridPos,omitempty"` // TODO docs Id *int `json:"id,omitempty"` // TODO docs // TODO tighter constraint Interval *string `json:"interval,omitempty"` LibraryPanel *LibraryPanelRef `json:"libraryPanel,omitempty"` // Panel links. // TODO fill this out - seems there are a couple variants? Links []Link `json:"links,omitempty"` // TODO docs MaxDataPoints *float32 `json:"maxDataPoints,omitempty"` // options is specified by the PanelOptions field in panel // plugin schemas. Options map[string]interface{} `json:"options"` // FIXME this almost certainly has to be changed in favor of scuemata versions PluginVersion *string `json:"pluginVersion,omitempty"` // Name of template variable to repeat for. Repeat *string `json:"repeat,omitempty"` // Direction to repeat in if 'repeat' is set. // "h" for horizontal, "v" for vertical. // TODO this is probably optional RepeatDirection PanelRepeatDirection `json:"repeatDirection"` // Id of the repeating panel. RepeatPanelId *int64 `json:"repeatPanelId,omitempty"` // TODO docs Tags []string `json:"tags,omitempty"` // TODO docs Targets []Target `json:"targets,omitempty"` // TODO docs - seems to be an old field from old dashboard alerts? Thresholds []interface{} `json:"thresholds,omitempty"` // TODO docs // TODO tighter constraint TimeFrom *string `json:"timeFrom,omitempty"` // TODO docs TimeRegions []interface{} `json:"timeRegions,omitempty"` // TODO docs // TODO tighter constraint TimeShift *string `json:"timeShift,omitempty"` // Panel title. Title *string `json:"title,omitempty"` Transformations []DataTransformerConfig `json:"transformations"` // Whether to display the panel without a background. Transparent bool `json:"transparent"` // The panel plugin type id. May not be empty. Type string `json:"type"` }
Dashboard panels. Panels are canonically defined inline because they share a version timeline with the dashboard schema; they do not evolve independently.
type PanelRepeatDirection ¶
type PanelRepeatDirection string
Direction to repeat in if 'repeat' is set. "h" for horizontal, "v" for vertical. TODO this is probably optional
const ( PanelRepeatDirectionH PanelRepeatDirection = "h" PanelRepeatDirectionV PanelRepeatDirection = "v" )
Defines values for PanelRepeatDirection.
type RangeMap ¶
type RangeMap struct { Options struct { // From to and from are `number | null` in current ts, really not sure what to do From float64 `json:"from"` // TODO docs Result ValueMappingResult `json:"result"` To float64 `json:"to"` } `json:"options"` Type RangeMapType `json:"type"` }
TODO docs
type RangeMapType ¶
type RangeMapType string
RangeMapType defines model for RangeMap.Type.
const ( RangeMapTypeRange RangeMapType = "range" RangeMapTypeRegex RangeMapType = "regex" RangeMapTypeSpecial RangeMapType = "special" RangeMapTypeValue RangeMapType = "value" )
Defines values for RangeMapType.
type RegexMap ¶
type RegexMap struct { Options struct { Pattern string `json:"pattern"` // TODO docs Result ValueMappingResult `json:"result"` } `json:"options"` Type RegexMapType `json:"type"` }
TODO docs
type RegexMapType ¶
type RegexMapType string
RegexMapType defines model for RegexMap.Type.
const ( RegexMapTypeRange RegexMapType = "range" RegexMapTypeRegex RegexMapType = "regex" RegexMapTypeSpecial RegexMapType = "special" RegexMapTypeValue RegexMapType = "value" )
Defines values for RegexMapType.
type RowPanel ¶
type RowPanel struct { Collapsed bool `json:"collapsed"` // Name of default datasource. Datasource *struct { Type *string `json:"type,omitempty"` Uid *string `json:"uid,omitempty"` } `json:"datasource,omitempty"` GridPos *GridPos `json:"gridPos,omitempty"` Id int `json:"id"` Panels []interface{} `json:"panels"` // Name of template variable to repeat for. Repeat *string `json:"repeat,omitempty"` Title *string `json:"title,omitempty"` Type RowPanelType `json:"type"` }
Row panel
type RowPanelType ¶
type RowPanelType string
RowPanelType defines model for RowPanel.Type.
const (
RowPanelTypeRow RowPanelType = "row"
)
Defines values for RowPanelType.
type Snapshot ¶
type Snapshot struct { // TODO docs Created time.Time `json:"created"` // TODO docs Expires string `json:"expires"` // TODO docs External bool `json:"external"` // TODO docs ExternalUrl string `json:"externalUrl"` // TODO docs Id int `json:"id"` // TODO docs Key string `json:"key"` // TODO docs Name string `json:"name"` // TODO docs OrgId int `json:"orgId"` // TODO docs Updated time.Time `json:"updated"` // TODO docs Url *string `json:"url,omitempty"` // TODO docs UserId int `json:"userId"` }
TODO docs
type SpecialValueMap ¶
type SpecialValueMap struct { Options struct { Match SpecialValueMapOptionsMatch `json:"match"` Pattern string `json:"pattern"` // TODO docs Result ValueMappingResult `json:"result"` } `json:"options"` Type SpecialValueMapType `json:"type"` }
TODO docs
type SpecialValueMapOptionsMatch ¶
type SpecialValueMapOptionsMatch string
SpecialValueMapOptionsMatch defines model for SpecialValueMap.Options.Match.
const ( SpecialValueMapOptionsMatchFalse SpecialValueMapOptionsMatch = "false" SpecialValueMapOptionsMatchTrue SpecialValueMapOptionsMatch = "true" )
Defines values for SpecialValueMapOptionsMatch.
type SpecialValueMapType ¶
type SpecialValueMapType string
SpecialValueMapType defines model for SpecialValueMap.Type.
const ( SpecialValueMapTypeRange SpecialValueMapType = "range" SpecialValueMapTypeRegex SpecialValueMapType = "regex" SpecialValueMapTypeSpecial SpecialValueMapType = "special" SpecialValueMapTypeValue SpecialValueMapType = "value" )
Defines values for SpecialValueMapType.
type SpecialValueMatch ¶
type SpecialValueMatch string
TODO docs
const ( SpecialValueMatchEmpty SpecialValueMatch = "empty" SpecialValueMatchFalse SpecialValueMatch = "false" SpecialValueMatchNan SpecialValueMatch = "nan" SpecialValueMatchNull SpecialValueMatch = "null" SpecialValueMatchNullNan SpecialValueMatch = "null+nan" SpecialValueMatchTrue SpecialValueMatch = "true" )
Defines values for SpecialValueMatch.
type Target ¶
type Target = map[string]interface{}
Schema for panel targets is specified by datasource plugins. We use a placeholder definition, which the Go schema loader either left open/as-is with the Base variant of the Dashboard and Panel families, or filled with types derived from plugins in the Instance variant. When working directly from CUE, importers can extend this type directly to achieve the same effect.
type Threshold ¶
type Threshold struct { // TODO docs Color string `json:"color"` // Threshold index, an old property that is not needed an should only appear in older dashboards Index *int32 `json:"index,omitempty"` // TODO docs // TODO are the values here enumerable into a disjunction? // Some seem to be listed in typescript comment State *string `json:"state,omitempty"` // TODO docs // FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON Value *float32 `json:"value,omitempty"` }
TODO docs
type ThresholdsConfig ¶
type ThresholdsConfig struct { Mode ThresholdsMode `json:"mode"` // Must be sorted by 'value', first value is always -Infinity Steps []Threshold `json:"steps"` }
ThresholdsConfig defines model for ThresholdsConfig.
type ThresholdsMode ¶
type ThresholdsMode string
ThresholdsMode defines model for ThresholdsMode.
const ( ThresholdsModeAbsolute ThresholdsMode = "absolute" ThresholdsModePercentage ThresholdsMode = "percentage" )
Defines values for ThresholdsMode.
type ValueMap ¶
type ValueMap struct { Options map[string]ValueMappingResult `json:"options"` Type ValueMapType `json:"type"` }
TODO docs
type ValueMapType ¶
type ValueMapType string
ValueMapType defines model for ValueMap.Type.
const ( ValueMapTypeRange ValueMapType = "range" ValueMapTypeRegex ValueMapType = "regex" ValueMapTypeSpecial ValueMapType = "special" ValueMapTypeValue ValueMapType = "value" )
Defines values for ValueMapType.
type ValueMappingResult ¶
type ValueMappingResult struct { Color *string `json:"color,omitempty"` Icon *string `json:"icon,omitempty"` Index *int32 `json:"index,omitempty"` Text *string `json:"text,omitempty"` }
TODO docs
type VariableHide ¶
type VariableHide int
VariableHide defines model for VariableHide.
const ( VariableHideN0 VariableHide = 0 VariableHideN1 VariableHide = 1 VariableHideN2 VariableHide = 2 )
Defines values for VariableHide.
type VariableModel ¶
type VariableModel struct { // Ref to a DataSource instance Datasource *DataSourceRef `json:"datasource,omitempty"` Description *string `json:"description,omitempty"` Error map[string]interface{} `json:"error,omitempty"` Global bool `json:"global"` Hide VariableHide `json:"hide"` Id string `json:"id"` Index int `json:"index"` Label *string `json:"label,omitempty"` Name string `json:"name"` // TODO: Move this into a separated QueryVariableModel type Query *interface{} `json:"query,omitempty"` RootStateKey *string `json:"rootStateKey,omitempty"` SkipUrlSync bool `json:"skipUrlSync"` State LoadingState `json:"state"` // FROM: packages/grafana-data/src/types/templateVars.ts // TODO docs // TODO this implies some wider pattern/discriminated union, probably? Type VariableType `json:"type"` }
FROM: packages/grafana-data/src/types/templateVars.ts TODO docs TODO what about what's in public/app/features/types.ts? TODO there appear to be a lot of different kinds of [template] vars here? if so need a disjunction
type VariableType ¶
type VariableType string
FROM: packages/grafana-data/src/types/templateVars.ts TODO docs TODO this implies some wider pattern/discriminated union, probably?
const ( VariableTypeAdhoc VariableType = "adhoc" VariableTypeConstant VariableType = "constant" VariableTypeCustom VariableType = "custom" VariableTypeDatasource VariableType = "datasource" VariableTypeInterval VariableType = "interval" VariableTypeQuery VariableType = "query" VariableTypeSystem VariableType = "system" VariableTypeTextbox VariableType = "textbox" )
Defines values for VariableType.