plugin

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatasource

NewDatasource creates a new datasource instance.

Types

type Data

type Data struct {
	ResultType string          `json:"resultType"`
	Result     json.RawMessage `json:"result"`
}

Data contains fields ResultType which defines type of the query response Result resents json of the query response

type Datasource

type Datasource struct {
	// contains filtered or unexported fields
}

Datasource is an example datasource which can respond to data queries, reports its health and has streaming skills.

func (*Datasource) CheckHealth

CheckHealth performs a request to the specified data source and returns an error if the HTTP handler did not return a 200 OK response.

func (*Datasource) Dispose

func (d *Datasource) Dispose()

Dispose here tells plugin SDK that plugin wants to clean up resources when a new instance created. As soon as datasource settings change detected by SDK old datasource instance will be disposed and a new one will be created using NewSampleDatasource factory function.

func (*Datasource) QueryData

QueryData handles multiple queries and returns multiple responses. req contains the queries []DataQuery (where each query contains RefID as a unique identifier). The QueryDataResponse contains a map of RefID to the response for each query, and each response contains Frames ([]*Frame).

type Labels

type Labels map[string]string

Labels represents timeseries labels

type Query

type Query struct {
	RefID         string `json:"refId"`
	Instant       bool   `json:"instant"`
	Range         bool   `json:"range"`
	Interval      string `json:"interval"`
	IntervalMs    int64  `json:"intervalMs"`
	TimeInterval  string `json:"timeInterval"`
	Expr          string `json:"expr"`
	LegendFormat  string `json:"legendFormat"`
	MaxDataPoints int64
	TimeRange     TimeRange
	// contains filtered or unexported fields
}

Query represents backend query object

type Response

type Response struct {
	Status string `json:"status"`
	Data   Data   `json:"data"`
}

Response contains fields from query response

type Result

type Result struct {
	Labels Labels  `json:"metric"`
	Values []Value `json:"values"`
	Value  Value   `json:"value"`
}

Result represents timeseries from query

type TimeRange

type TimeRange struct {
	From time.Time
	To   time.Time
}

TimeRange represents time range backend object

type Value

type Value [2]interface{}

Value represents timestamp and value of the timeseries

Jump to

Keyboard shortcuts

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