Documentation ¶
Index ¶
- func CheckHealth(ctx context.Context, d Datasource, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func GetDatasourceOpts() datasource.ServeOpts
- func GetQueryHandlers(s *Server) *datasource.QueryTypeMux
- func HandleQueryData(ctx context.Context, d Datasource, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func UnmarshalQuery(b []byte, v interface{}) *backend.DataResponse
- type Datasource
- type Handler
- type Instance
- func (i *Instance) CheckHealth(ctx context.Context) error
- func (i *Instance) HandleApplicationErrorsQuery(ctx context.Context, q *models.ApplicationErrorsQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (i *Instance) HandleLogQuery(ctx context.Context, q *models.LogQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (i *Instance) HandleMetricsQuery(ctx context.Context, q *models.MetricsQuery, req backend.DataQuery) (dfutil.Framer, error)
- type QueryHandlerFunc
- type Server
- func (s *Server) HandleApplicationErrors(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *Server) HandleLog(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *Server) HandleMetrics(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckHealth ¶
func CheckHealth(ctx context.Context, d Datasource, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
CheckHealth ensures that the datasource settings are able to retrieve data from
func GetDatasourceOpts ¶
func GetDatasourceOpts() datasource.ServeOpts
GetDatasourceOpts returns the datasource.ServeOpts for this plugin
func GetQueryHandlers ¶
func GetQueryHandlers(s *Server) *datasource.QueryTypeMux
GetQueryHandlers creates the QueryTypeMux type for handling queries
func HandleQueryData ¶
func HandleQueryData(ctx context.Context, d Datasource, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleQueryData handles the `QueryData` request for the datasource
func UnmarshalQuery ¶
func UnmarshalQuery(b []byte, v interface{}) *backend.DataResponse
UnmarshalQuery attempts to unmarshal a query from JSON
Types ¶
type Datasource ¶
type Datasource interface { HandleMetricsQuery(context.Context, *models.MetricsQuery, backend.DataQuery) (dfutil.Framer, error) HandleLogQuery(context.Context, *models.LogQuery, backend.DataQuery) (dfutil.Framer, error) HandleApplicationErrorsQuery(context.Context, *models.ApplicationErrorsQuery, backend.DataQuery) (dfutil.Framer, error) CheckHealth(context.Context) error }
The Datasource type handles the requests sent to the datasource backend
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the plugin entrypoint and implements all of the necessary handler functions for dataqueries, healthchecks, and resources.
func (*Handler) CheckHealth ¶
func (cr *Handler) 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 (*Handler) QueryData ¶
func (cr *Handler) 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 identifer). The QueryDataResponse contains a map of RefID to the response for each query, and each response contains Frames ([]*Frame).
type Instance ¶
type Instance struct {
Datasource Datasource
}
Instance is the root Datasource implementation that wraps a Datasource
func NewInstance ¶
NewInstance creates a new Instance using the settings to determine if things like the Caching Wrapper should be enabled
func (*Instance) CheckHealth ¶
CheckHealth ...
func (*Instance) HandleApplicationErrorsQuery ¶
func (*Instance) HandleLogQuery ¶
type QueryHandlerFunc ¶
QueryHandlerFunc is the function signature used for mux.HandleFunc
type Server ¶
type Server struct {
Datasource Datasource
}
Server is the main handler for datasource queries. It forwards requests to the embedded datasource interface.
func (*Server) HandleApplicationErrors ¶
func (s *Server) HandleApplicationErrors(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
func (*Server) HandleLog ¶
func (s *Server) HandleLog(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
func (*Server) HandleMetrics ¶
func (s *Server) HandleMetrics(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)