Documentation
¶
Index ¶
- type Data
- type DataSourceInstanceSettings
- type Datasource
- func (d *Datasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (d *Datasource) RootHandler(rw http.ResponseWriter, req *http.Request)
- func (d *Datasource) VMAPIQuery(rw http.ResponseWriter, req *http.Request)
- func (d *Datasource) VMUIQuery(rw http.ResponseWriter, req *http.Request)
- type DatasourceInstance
- type Labels
- type Query
- type Response
- type Result
- type TimeRange
- type Trace
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 DataSourceInstanceSettings ¶ added in v0.18.3
type DataSourceInstanceSettings struct { QueryParams string `json:"customQueryParameters,omitempty"` VMUIURL string `json:"vmuiUrl,omitempty"` TimeInterval string `json:"timeInterval,omitempty"` QueryTimeout string `json:"queryTimeout,omitempty"` HTTPMethod string `json:"httpMethod,omitempty"` }
DataSourceInstanceSettings contains settings for the datasource instance.
type Datasource ¶
type Datasource struct { backend.CallResourceHandler // contains filtered or unexported fields }
Datasource describes a plugin service that manages DatasourceInstance entities
func NewDatasource ¶
func NewDatasource() *Datasource
NewDatasource creates a new datasource instance.
func (*Datasource) CheckHealth ¶
func (d *Datasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
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) QueryData ¶
func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
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).
func (*Datasource) RootHandler ¶ added in v0.18.0
func (d *Datasource) RootHandler(rw http.ResponseWriter, req *http.Request)
RootHandler returns generic response to unsupported paths
func (*Datasource) VMAPIQuery ¶ added in v0.18.0
func (d *Datasource) VMAPIQuery(rw http.ResponseWriter, req *http.Request)
VMAPIQuery performs request to VM API endpoints that doesn't return frames
func (*Datasource) VMUIQuery ¶ added in v0.18.0
func (d *Datasource) VMUIQuery(rw http.ResponseWriter, req *http.Request)
VMUIQuery generates VMUI link to a native dashboard
type DatasourceInstance ¶ added in v0.18.0
type DatasourceInstance struct {
// contains filtered or unexported fields
}
DatasourceInstance is an example datasource which can respond to data queries, reports its health and has streaming skills.
func (*DatasourceInstance) Dispose ¶ added in v0.18.0
func (di *DatasourceInstance) 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.
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"` Trace int `json:"trace,omitempty"` MaxDataPoints int64 TimeRange TimeRange BackendQueryInterval time.Duration }
Query represents backend query object
type Response ¶
type Response struct { Status string `json:"status"` Data Data `json:"data"` Trace *Trace `json:"trace,omitempty"` ForAlerting bool `json:"-"` }
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