Documentation ¶
Index ¶
- func NewCloudTraceDatasource(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- type CloudTraceDatasource
- func (d *CloudTraceDatasource) CallResource(ctx context.Context, req *backend.CallResourceRequest, ...) error
- func (d *CloudTraceDatasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (d *CloudTraceDatasource) Dispose()
- func (d *CloudTraceDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCloudTraceDatasource ¶
func NewCloudTraceDatasource(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
NewCloudTraceDatasource creates a new datasource instance.
Types ¶
type CloudTraceDatasource ¶
type CloudTraceDatasource struct {
// contains filtered or unexported fields
}
CloudTraceDatasource is an example datasource which can respond to data queries, reports its health and has streaming skills.
func (*CloudTraceDatasource) CallResource ¶
func (d *CloudTraceDatasource) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error
CallResource fetches some resource from GCP using the data source's credentials
Currently only projects are fetched, other requests receive a 404
func (*CloudTraceDatasource) CheckHealth ¶
func (d *CloudTraceDatasource) 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 (*CloudTraceDatasource) Dispose ¶
func (d *CloudTraceDatasource) 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 (*CloudTraceDatasource) QueryData ¶
func (d *CloudTraceDatasource) 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).