Documentation ¶
Index ¶
- func NewDatasource(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
- type Datasource
- type GetQueryResponse
- type Query
- type ResourceHandler
- type StatsHouseAPIHTTPClient
- func (c StatsHouseAPIHTTPClient) GetMetric(metricName string) (*api.MetricInfo, error)
- func (c StatsHouseAPIHTTPClient) GetMetricTagValues(params url.Values) (*api.GetMetricTagValuesResp, error)
- func (c StatsHouseAPIHTTPClient) GetMetricsList() (*api.GetMetricsListResp, error)
- func (c StatsHouseAPIHTTPClient) GetQuery(params url.Values) (*GetQueryResponse, error)
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatasource ¶
func NewDatasource(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error)
NewDatasource creates a new datasource instance.
Types ¶
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(_ 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) 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).
type GetQueryResponse ¶
type GetQueryResponse struct { Series struct { Time []int64 `json:"time"` SeriesMeta []api.QuerySeriesMetaV2 `json:"series_meta"` SeriesData [][]*float64 `json:"series_data"` } `json:"series"` }
func (GetQueryResponse) MarshalEasyJSON ¶
func (v GetQueryResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (*GetQueryResponse) UnmarshalEasyJSON ¶
func (v *GetQueryResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
type Query ¶
type Query struct { TopN int64 MetricName string TimeFrom int64 TimeTo int64 Interval string Function string What []string GroupBy []string Filters []string Shifts []int64 }
func (Query) GetURLParams ¶
type ResourceHandler ¶
type ResourceHandler struct {
// contains filtered or unexported fields
}
type StatsHouseAPIHTTPClient ¶
type StatsHouseAPIHTTPClient struct { URL string // contains filtered or unexported fields }
func NewHTTPClient ¶
func NewHTTPClient(url string, accessToken string, timeout time.Duration) StatsHouseAPIHTTPClient
func (StatsHouseAPIHTTPClient) GetMetric ¶
func (c StatsHouseAPIHTTPClient) GetMetric(metricName string) (*api.MetricInfo, error)
func (StatsHouseAPIHTTPClient) GetMetricTagValues ¶
func (c StatsHouseAPIHTTPClient) GetMetricTagValues(params url.Values) (*api.GetMetricTagValuesResp, error)
func (StatsHouseAPIHTTPClient) GetMetricsList ¶
func (c StatsHouseAPIHTTPClient) GetMetricsList() (*api.GetMetricsListResp, error)
func (StatsHouseAPIHTTPClient) GetQuery ¶
func (c StatsHouseAPIHTTPClient) GetQuery(params url.Values) (*GetQueryResponse, error)