model

package
v0.2.1-0...-b772245 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConstantVariableSource

type ConstantVariableSource struct {
	Value string `json:"value,omitempty"`
}

ConstantVariableSource represents the constant variables.

type Dashboard

type Dashboard struct {
	Grid      Grid       `json:"grid,omitempty"`
	Variables []Variable `json:"variables,omitempty"`
	Widgets   []Widget   `json:"widgets,omitempty"`
}

Dashboard represents a dashboard.

func (*Dashboard) Validate

func (d *Dashboard) Validate() error

Validate validates the object model is correct. A correct object means that also it will autofill the required default attributes so the object ends in a valid state.

type Datasource

type Datasource struct {
	ID               string
	DatasourceSource `json:",inline"`
}

Datasource is where the data will be retrieved.

func (Datasource) Validate

func (d Datasource) Validate() error

Validate validates the object model is correct.

type DatasourceSource

type DatasourceSource struct {
	Fake       *FakeDatasource       `json:"fake,omitempty"`
	Prometheus *PrometheusDatasource `json:"prometheus,omitempty"`
	Graphite   *GraphiteDatasource   `json:"graphite,omitempty"`
}

DatasourceSource represents the datasource.

type FakeDatasource

type FakeDatasource struct{}

FakeDatasource is the fake datasource.

type GaugeWidgetSource

type GaugeWidgetSource struct {
	Query        Query       `json:"query,omitempty"`
	PercentValue bool        `json:"percentValue,omitempty"`
	Max          int         `json:"max,omitempty"`
	Min          int         `json:"min,omitempty"`
	Thresholds   []Threshold `json:"thresholds,omitempty"`
}

GaugeWidgetSource represents a simple value widget in donut format.

type GraphVisualization

type GraphVisualization struct {
	SeriesOverride []SeriesOverride `json:"seriesOverride,omitempty"`
	Legend         Legend           `json:"legend,omitempty"`
	YAxis          YAxis            `json:"yAxis,omitempty"`
}

GraphVisualization controls how the graph will visualize lines, colors, legend...

type GraphWidgetSource

type GraphWidgetSource struct {
	Queries       []Query            `json:"queries,omitempty"`
	Visualization GraphVisualization `json:"visualization,omitempty"`
}

GraphWidgetSource represents a simple value widget in donut format.

type GraphiteDatasource

type GraphiteDatasource struct {
	Address string `json:"address,omitempty"`
}

GraphiteDatasource is the Graphite kind datasource.

type Grid

type Grid struct {
	// Fixed means that the grid positions (gridPos) of the widgets
	// will be fixed and need X and Y values.
	// If false it will be adaptive and will ignore X and Y values
	// and only use the size of the widget (W, width).
	FixedWidgets bool `json:"fixedWidgets,omitempty"`
	// MaxWidth is the maximum width (horizontal) the Grid will have, this will be
	// the scale for the widgets `GridPos.W`. For example a `GridPos.W: 50`
	// in a `Grid.MaxWidth: 100` would be half of the row, but in a `Grid.MaxWidth: 1000`
	// would be a 5% of the row.
	// Not setting MaxWidth or setting to 0 would fallback to default MaxWidth.
	MaxWidth int `json:"maxWidth,omitempty"`
}

Grid represents the options of the grid in the dashboard.

type GridPos

type GridPos struct {
	// X represents the position on the grid (from 0 to 100).
	X int `json:"x,omitempty"`
	// Y represents the position on the grid (from 0 to infinite,
	// where the total will be used using all the widgets Y and H).
	Y int `json:"y,omitempty"`
	// W represents the width of the widget (same unit as X).
	W int `json:"w,omitempty"`
}

GridPos represents the grid position.

type IntervalVariableSource

type IntervalVariableSource struct {
	Steps int `json:"steps,omitempty"`
}

IntervalVariableSource represents the interval variables.

type Legend

type Legend struct {
	Disable   bool `json:"disable,omitempty"`
	RightSide bool `json:"rightSide,omitempty"`
}

Legend controls the legend of a widget.

type Metric

type Metric struct {
	Value float64
	TS    time.Time
}

Metric represents a measured value in time.

type MetricSeries

type MetricSeries struct {
	ID      string
	Labels  map[string]string
	Metrics []Metric
}

MetricSeries is a group of metrics identified by an ID and a context information.

type NullPointMode

type NullPointMode string

NullPointMode is how the graph should behave when there are null points on the graph.

const (
	// NullPointModeAsNull is the default mode, it will not fill the null values.
	NullPointModeAsNull NullPointMode = "null"
	// NullPointModeConnected will try to connect the null values copying the nearest values.
	NullPointModeConnected NullPointMode = "connected"
	// NullPointModeAsZero will render the null values as zeroes.
	NullPointModeAsZero NullPointMode = "zero"
)

type PrometheusDatasource

type PrometheusDatasource struct {
	Address string `json:"address,omitempty"`
}

PrometheusDatasource is the Prometheus kind datasource.

type Query

type Query struct {
	Expr string `json:"expr,omitempty"`
	// Legend accepts `text.template` format.
	Legend       string `json:"legend,omitempty"`
	DatasourceID string `json:"datasourceID,omitempty"`
}

Query is the query that will be made to the datasource.

type SeriesOverride

type SeriesOverride struct {
	Regex         string         `json:"regex,omitempty"`
	CompiledRegex *regexp.Regexp `json:"-"`
	Color         string         `json:"color,omitempty"`
	NullPointMode NullPointMode  `json:"nullPointMode,omitempty"`
}

SeriesOverride will override visualization based on the regex legend.

type SinglestatWidgetSource

type SinglestatWidgetSource struct {
	ValueRepresentation `json:",inline"`
	Query               Query       `json:"query,omitempty"`
	ValueText           string      `json:"valueText,omitempty"`
	Thresholds          []Threshold `json:"thresholds,omitempty"`
}

SinglestatWidgetSource represents a simple value widget.

type Threshold

type Threshold struct {
	StartValue float64 `json:"startValue"`
	Color      string  `json:"color"`
}

Threshold is a color threshold that is composed with the start value, 0 means the base or starting threshold.

type ValueRepresentation

type ValueRepresentation struct {
	Unit     string `json:"unit,omitempty"`
	Decimals int    `json:"decimals,omitempty"`
}

ValueRepresentation controls the representation of a value.

type Variable

type Variable struct {
	Name           string `json:"name,omitempty"`
	VariableSource `json:",inline"`
}

Variable is a dynamic variable that will be available through the dashboard.

type VariableSource

type VariableSource struct {
	Constant *ConstantVariableSource `json:"constant,omitempty"`
	Interval *IntervalVariableSource `json:"interval,omitempty"`
}

VariableSource is the variable kind with it's data.

type Widget

type Widget struct {
	Title        string  `json:"title,omitempty"`
	GridPos      GridPos `json:"gridPos,omitempty"`
	WidgetSource `json:",inline"`
}

Widget represents a widget.

type WidgetSource

type WidgetSource struct {
	Singlestat *SinglestatWidgetSource `json:"singlestat,omitempty"`
	Gauge      *GaugeWidgetSource      `json:"gauge,omitempty"`
	Graph      *GraphWidgetSource      `json:"graph,omitempty"`
}

WidgetSource will tell what kind of widget is.

type YAxis

type YAxis struct {
	ValueRepresentation `json:",inline"`
}

YAxis controls the YAxis of a widget.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL