Documentation ¶
Index ¶
- Constants
- func NewDatasource(ctx context.Context, settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- type AplQueryRequest
- type DatasetField
- type DatasetFields
- type Datasource
- func (d *Datasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (d *Datasource) DatasetFields(ctx context.Context) ([]*DatasetFields, error)
- func (d *Datasource) Dispose()
- func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (d *Datasource) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
const Version = "0.6.1"
TODO: automate parsing the version from the package.json file
Variables ¶
This section is empty.
Functions ¶
func NewDatasource ¶
func NewDatasource(ctx context.Context, settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
NewDatasource creates a new datasource instance.
Types ¶
type AplQueryRequest ¶ added in v0.1.3
type DatasetField ¶ added in v0.1.4
type DatasetFields ¶ added in v0.1.4
type DatasetFields struct { DatasetName string `json:"datasetName"` Fields []DatasetField `json:"fields"` }
type Datasource ¶
type Datasource struct { backend.CallResourceHandler // 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 ¶
func (d *Datasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
CheckHealth handles health checks sent from Grafana to the plugin. The main use case for these health checks is the test button on the datasource configuration page which allows users to verify that a datasource is working as expected.
func (*Datasource) DatasetFields ¶ added in v0.1.4
func (d *Datasource) DatasetFields(ctx context.Context) ([]*DatasetFields, error)
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 ¶
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) ServeHTTP ¶ added in v0.1.7
func (d *Datasource) ServeHTTP(w http.ResponseWriter, r *http.Request)