query

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderPluginID       = "X-Plugin-Id"         // can be used for routing
	HeaderDatasourceUID  = "X-Datasource-Uid"    // can be used for routing/ load balancing
	HeaderDashboardUID   = "X-Dashboard-Uid"     // mainly useful for debugging slow queries
	HeaderPanelID        = "X-Panel-Id"          // mainly useful for debugging slow queries
	HeaderQueryGroupID   = "X-Query-Group-Id"    // mainly useful for finding related queries with query chunking
	HeaderFromExpression = "X-Grafana-From-Expr" // used by datasources to identify expression queries
)

Variables

View Source
var (
	ErrNoQueriesFound        = errutil.NewBase(errutil.StatusBadRequest, "query.noQueries", errutil.WithPublicMessage("No queries found")).Errorf("no queries found")
	ErrInvalidDatasourceID   = errutil.NewBase(errutil.StatusBadRequest, "query.invalidDatasourceId", errutil.WithPublicMessage("Query does not contain a valid data source identifier")).Errorf("invalid data source identifier")
	ErrMissingDataSourceInfo = errutil.NewBase(errutil.StatusBadRequest, "query.missingDataSourceInfo").MustTemplate("query missing datasource info: {{ .Public.RefId }}", errutil.WithPublic("Query {{ .Public.RefId }} is missing datasource information"))
	ErrQueryParamMismatch    = errutil.NewBase(errutil.StatusBadRequest, "query.headerMismatch", errutil.WithPublicMessage("The request headers point to a different plugin than is defined in the request body")).Errorf("plugin header/body mismatch")
	ErrDuplicateRefId        = errutil.NewBase(errutil.StatusBadRequest, "query.duplicateRefId", errutil.WithPublicMessage("Multiple queries using the same RefId is not allowed ")).Errorf("multiple queries using the same RefId is not allowed")
)

Functions

This section is empty.

Types

type FakeQueryService

type FakeQueryService struct {
	mock.Mock
}

FakeQueryService is an autogenerated mock type for the Service type

func NewFakeQueryService

func NewFakeQueryService(t mockConstructorTestingTNewFakeQueryService) *FakeQueryService

NewFakeQueryService creates a new instance of FakeQueryService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*FakeQueryService) QueryData

func (_m *FakeQueryService) QueryData(ctx context.Context, _a1 *user.SignedInUser, skipDSCache bool, reqDTO dtos.MetricRequest) (*backend.QueryDataResponse, error)

QueryData provides a mock function with given fields: ctx, _a1, skipDSCache, reqDTO

func (*FakeQueryService) Run

func (_m *FakeQueryService) Run(ctx context.Context) error

Run provides a mock function with given fields: ctx

type Service

type Service interface {
	Run(ctx context.Context) error
	QueryData(ctx context.Context, user *user.SignedInUser, skipDSCache bool, reqDTO dtos.MetricRequest) (*backend.QueryDataResponse, error)
}

type ServiceImpl

type ServiceImpl struct {
	// contains filtered or unexported fields
}

func ProvideService

func ProvideService(
	cfg *setting.Cfg,
	dataSourceCache datasources.CacheService,
	expressionService *expr.Service,
	pluginRequestValidator validations.PluginRequestValidator,
	pluginClient plugins.Client,
	pCtxProvider *plugincontext.Provider,
) *ServiceImpl

func (*ServiceImpl) QueryData

func (s *ServiceImpl) QueryData(ctx context.Context, user *user.SignedInUser, skipDSCache bool, reqDTO dtos.MetricRequest) (*backend.QueryDataResponse, error)

QueryData processes queries and returns query responses. It handles queries to single or mixed datasources, as well as expressions.

func (*ServiceImpl) Run

func (s *ServiceImpl) Run(ctx context.Context) error

Run ServiceImpl.

Jump to

Keyboard shortcuts

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