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
- func (cr *Handler) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (cr *Handler) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (cr *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Instance
- type QueryHandlerFunc
- type Server
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 GitLab.
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 GitLab 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 { HandleCommitsQuery(context.Context, *models.CommitsQuery, 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 identifier). 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 NewGitLabInstance ¶
NewGitLabInstance creates a new NewGitLabInstance using the settings to determine if things like the Caching Wrapper should be enabled.
func (*Instance) CheckHealth ¶
CheckHealth performs a data source health check.
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) HandleCommits ¶
func (s *Server) HandleCommits(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleCommits handles the plugin query for GitLab Commits