plugin

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIOxDatasource

NewIOxDatasource creates a new datasource instance.

func NewSampleDatasource

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

type IOxDatasource struct {
	Host     string
	Database string
	// contains filtered or unexported fields
}

IOxDatasource can respond to queries and describe its health.

func (*IOxDatasource) CheckHealth

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

PublishStream is called when a client sends a message to the stream.

func (*IOxDatasource) 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).

func (*IOxDatasource) RunStream

RunStream is called once for any open channel. Results are shared with everyone subscribed to the same channel.

func (*IOxDatasource) SubscribeStream

SubscribeStream is called when a client wants to connect to a stream. This callback allows sending the first message.

type IOxFlightQuery

type IOxFlightQuery struct {
	DatabaseName string `json:"database_name"`
	Query        string `json:"sql_query"`
}

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

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

PublishStream is called when a client sends a message to the stream.

func (*SampleDatasource) 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).

func (*SampleDatasource) RunStream

RunStream is called once for any open channel. Results are shared with everyone subscribed to the same channel.

func (*SampleDatasource) SubscribeStream

SubscribeStream is called when a client wants to connect to a stream. This callback allows sending the first message.

Jump to

Keyboard shortcuts

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