Documentation
¶
Overview ¶
Package minisdk contains a minified version of the model found in github.com/grafana-tools/sdk. Most of the model parts were stripped of to reduce the unmarshaling issues caused by model evolution, as our objective is to just find the queries contained in the dashboards.
This model could now be probably simplified, but it's left in a form compatible with the original model, so it would be easier to switch back if that's ever fixed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct { Name string `json:"name"` Datasource *DatasourceRef `json:"datasource"` Query string `json:"query"` Expr string `json:"expr"` Type string `json:"type"` }
type Board ¶
type Board struct { ID uint `json:"id,omitempty"` UID string `json:"uid,omitempty"` Slug string `json:"slug"` Title string `json:"title"` Tags []string `json:"tags"` Panels []*Panel `json:"panels"` Rows []*Row `json:"rows"` Templating Templating `json:"templating"` Annotations struct { List []Annotation `json:"list"` } `json:"annotations"` }
Board represents Grafana dashboard.
type DatasourceRef ¶
type DatasourceRef struct { // Type describes the type of the datasource, like "prometheus", "graphite", etc. // Datasources of the same type should support same queries. // If Type is empty in an unmarshaled DatasourceRef, check the LegacyName field. Type string `json:"type"` // UID is the uid of the specific datasource this references to. UID string `json:"UID"` // LegacyName is the old way of referencing a datasource by its name, replaced in Grafana v8.4.3 by Type and UID referencing. // If datasource is encoded as a string, then it's unmarshaled into this LegacyName field (Type and UID will be empty). // If LegacyName is not empty, then this DatasourceRef will be marshaled as a string, ignoring the values of Type and UID. LegacyName string `json:"-"` }
DatasourceRef is used to reference a datasource from panels, queries, etc.
func (DatasourceRef) MarshalJSON ¶
func (ref DatasourceRef) MarshalJSON() ([]byte, error)
func (*DatasourceRef) UnmarshalJSON ¶
func (ref *DatasourceRef) UnmarshalJSON(data []byte) error
type Panel ¶
type Panel struct { Targets []Target `json:"targets,omitempty"` SubPanels []Panel `json:"panels"` Type string `json:"type"` }
Panel represents panels of different types defined in a Grafana dashboard.
func (*Panel) GetTargets ¶
GetTargets for the Panel. GetTargets returns nil if the Panel has no targets.
func (*Panel) SupportsTargets ¶
SupportsTargets returns true if the Panel type supports targets. The fact that a Panel type supports targets does not guarantee that the Panel has any; it is valid for a Panel to have no targets, even if it supports them.
type Row ¶
type Row struct {
Panels []Panel `json:"panels"`
}
Row represents single row of Grafana dashboard.
type Target ¶
type Target struct { Datasource *DatasourceRef `json:"datasource,omitempty"` Expr string `json:"expr,omitempty"` }
Target describes an expression with which the Panel fetches data from a data source. A Panel may have zero, one or multiple targets. Not all Panel types support targets. For example, a text Panel cannot have any targets. Panel types that do support target are not guaranteed to have any. For example, a gauge Panel can be created without any configured queries. In this case, the Panel will have no targets.
type TemplateVar ¶
type TemplateVar struct { Name string `json:"name"` Type string `json:"type"` Datasource *DatasourceRef `json:"datasource"` Refresh BoolInt `json:"refresh"` Query interface{} `json:"query"` }
type Templating ¶
type Templating struct {
List []TemplateVar `json:"list"`
}