Documentation ¶
Index ¶
- func NewIOxDatasource(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- func NewSampleDatasource(_ backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- type FlightClient
- type IOxDatasource
- func (d *IOxDatasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (d *IOxDatasource) Dispose()
- func (d *IOxDatasource) PublishStream(_ context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
- func (d *IOxDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (d *IOxDatasource) RunStream(ctx context.Context, req *backend.RunStreamRequest, ...) error
- func (d *IOxDatasource) SubscribeStream(_ context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
- type IOxFlightQuery
- type SampleDatasource
- func (d *SampleDatasource) CheckHealth(_ context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (d *SampleDatasource) Dispose()
- func (d *SampleDatasource) PublishStream(_ context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
- func (d *SampleDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (d *SampleDatasource) RunStream(ctx context.Context, req *backend.RunStreamRequest, ...) error
- func (d *SampleDatasource) SubscribeStream(_ context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIOxDatasource ¶
func NewIOxDatasource(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
NewIOxDatasource creates a new datasource instance.
func NewSampleDatasource ¶
func NewSampleDatasource(_ backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
NewSampleDatasource creates a new datasource instance.
Types ¶
type FlightClient ¶
type FlightClient struct {
// contains filtered or unexported fields
}
func NewFlightClient ¶
func NewFlightClient(addr string) (*FlightClient, error)
type IOxDatasource ¶
IOxDatasource can respond to queries and describe its health.
func (*IOxDatasource) CheckHealth ¶
func (d *IOxDatasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
CheckHealth handles health checks sent from Grafana to the IOx backend. Health is checked by dialling a connection using the set host and ensuring that the specified database exists.
func (*IOxDatasource) Dispose ¶
func (d *IOxDatasource) 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 NewIOxDatasource factory function.
func (*IOxDatasource) PublishStream ¶
func (d *IOxDatasource) PublishStream(_ context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
PublishStream is called when a client sends a message to the stream.
func (*IOxDatasource) QueryData ¶
func (d *IOxDatasource) 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 (*IOxDatasource) RunStream ¶
func (d *IOxDatasource) RunStream(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error
RunStream is called once for any open channel. Results are shared with everyone subscribed to the same channel.
func (*IOxDatasource) SubscribeStream ¶
func (d *IOxDatasource) SubscribeStream(_ context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
SubscribeStream is called when a client wants to connect to a stream. This callback allows sending the first message.
type IOxFlightQuery ¶
type SampleDatasource ¶
type SampleDatasource struct{}
SampleDatasource is an example datasource which can respond to data queries, reports its health and has streaming skills.
func (*SampleDatasource) CheckHealth ¶
func (d *SampleDatasource) CheckHealth(_ 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 (*SampleDatasource) Dispose ¶
func (d *SampleDatasource) 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 (*SampleDatasource) PublishStream ¶
func (d *SampleDatasource) PublishStream(_ context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error)
PublishStream is called when a client sends a message to the stream.
func (*SampleDatasource) QueryData ¶
func (d *SampleDatasource) 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 (*SampleDatasource) RunStream ¶
func (d *SampleDatasource) RunStream(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error
RunStream is called once for any open channel. Results are shared with everyone subscribed to the same channel.
func (*SampleDatasource) SubscribeStream ¶
func (d *SampleDatasource) SubscribeStream(_ context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error)
SubscribeStream is called when a client wants to connect to a stream. This callback allows sending the first message.