options

package
v0.15.11 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsQueryEngineSet

func IsQueryEngineSet(v string) bool

IsQueryEngineSet returns true if value contains query engine value. Otherwise returns false.

Types

type CustomHandler

type CustomHandler interface {
	// Route is the custom handler route.
	Route() string
	// Methods is the list of http methods this handler services.
	Methods() []string
	// Handler is the custom handler itself.
	Handler(handlerOptions HandlerOptions) (http.Handler, error)
}

CustomHandler allows for custom third party http handlers.

type CustomHandlerOptions

type CustomHandlerOptions struct {
	CustomHandlers    []CustomHandler
	OptionTransformFn OptionTransformFn
}

CustomHandlerOptions is a list of custom handler options.

type HandlerOptions

type HandlerOptions interface {
	// CreatedAt returns the time the options were created.
	CreatedAt() time.Time

	// Storage returns the set storage.
	Storage() storage.Storage
	// SetStorage sets the set storage.
	SetStorage(s storage.Storage) HandlerOptions

	// DownsamplerAndWriter returns the set downsampler and writer.
	DownsamplerAndWriter() ingest.DownsamplerAndWriter
	// SetDownsamplerAndWriter sets the set downsampler and writer.
	SetDownsamplerAndWriter(d ingest.DownsamplerAndWriter) HandlerOptions

	// Engine returns the engine.
	Engine() executor.Engine
	// SetEngine sets the engine.
	SetEngine(e executor.Engine) HandlerOptions

	// PrometheusEngine returns the prometheus engine.
	PrometheusEngine() *promql.Engine
	// SetPrometheusEngine sets the prometheus engine.
	SetPrometheusEngine(e *promql.Engine) HandlerOptions

	// Clusters returns the clusters.
	Clusters() m3.Clusters
	// SetClusters sets the clusters.
	SetClusters(c m3.Clusters) HandlerOptions

	// ClusterClient returns the cluster client.
	ClusterClient() clusterclient.Client
	// SetClusterClient sets the cluster client.
	SetClusterClient(c clusterclient.Client) HandlerOptions

	// Config returns the config.
	Config() config.Configuration
	// SetConfig sets the config.
	SetConfig(c config.Configuration) HandlerOptions

	// EmbeddedDbCfg returns the embedded db config.
	EmbeddedDbCfg() *dbconfig.DBConfiguration
	// SetEmbeddedDbCfg sets the embedded db config.
	SetEmbeddedDbCfg(c *dbconfig.DBConfiguration) HandlerOptions

	// TagOptions returns the tag options.
	TagOptions() models.TagOptions
	// SetTagOptions sets the tag options.
	SetTagOptions(opts models.TagOptions) HandlerOptions

	// TimeoutOpts returns the timeout options.
	TimeoutOpts() *prometheus.TimeoutOpts
	// SetTimeoutOpts sets the timeout options.
	SetTimeoutOpts(t *prometheus.TimeoutOpts) HandlerOptions

	// Enforcer returns the enforcer.
	Enforcer() cost.ChainedEnforcer
	// SetEnforcer sets the enforcer.
	SetEnforcer(e cost.ChainedEnforcer) HandlerOptions

	// FetchOptionsBuilder returns the fetch options builder.
	FetchOptionsBuilder() handleroptions.FetchOptionsBuilder
	// SetFetchOptionsBuilder sets the fetch options builder.
	SetFetchOptionsBuilder(b handleroptions.FetchOptionsBuilder) HandlerOptions

	// QueryContextOptions returns the query context options.
	QueryContextOptions() models.QueryContextOptions
	// SetQueryContextOptions sets the query context options.
	SetQueryContextOptions(o models.QueryContextOptions) HandlerOptions

	// CPUProfileDuration returns the cpu profile duration.
	CPUProfileDuration() time.Duration
	// SetCPUProfileDuration sets the cpu profile duration.
	SetCPUProfileDuration(c time.Duration) HandlerOptions

	// PlacementServiceNames returns the placement service names.
	PlacementServiceNames() []string
	// SetPlacementServiceNames sets the placement service names.
	SetPlacementServiceNames(n []string) HandlerOptions

	// ServiceOptionDefaults returns the service option defaults.
	ServiceOptionDefaults() []handleroptions.ServiceOptionsDefault
	// SetServiceOptionDefaults sets the service option defaults.
	SetServiceOptionDefaults(s []handleroptions.ServiceOptionsDefault) HandlerOptions

	// NowFn returns the now function.
	NowFn() clock.NowFn
	// SetNowFn sets the now function.
	SetNowFn(f clock.NowFn) HandlerOptions

	// InstrumentOpts returns the instrumentation options.
	InstrumentOpts() instrument.Options
	// SetInstrumentOpts sets instrumentation options.
	SetInstrumentOpts(opts instrument.Options) HandlerOptions

	// DefaultQueryEngine returns the default query engine.
	DefaultQueryEngine() QueryEngine
	// SetDefaultQueryEngine returns the default query engine.
	SetDefaultQueryEngine(value QueryEngine) HandlerOptions

	// QueryRouter is a reference to the router which is responsible for routing
	// queries between PromQL and M3Query.
	QueryRouter() QueryRouter
	// SetQueryRouter sets query router.
	SetQueryRouter(value QueryRouter) HandlerOptions

	// InstantQueryRouter is a reference to the router which is responsible for
	// routing instant queries between PromQL and M3Query.
	InstantQueryRouter() QueryRouter
	// SetInstantQueryRouter sets query router for instant queries.
	SetInstantQueryRouter(value QueryRouter) HandlerOptions
}

HandlerOptions represents handler options.

func EmptyHandlerOptions

func EmptyHandlerOptions() HandlerOptions

EmptyHandlerOptions returns default handler options.

func NewHandlerOptions

func NewHandlerOptions(
	downsamplerAndWriter ingest.DownsamplerAndWriter,
	tagOptions models.TagOptions,
	engine executor.Engine,
	prometheusEngine *promql.Engine,
	m3dbClusters m3.Clusters,
	clusterClient clusterclient.Client,
	cfg config.Configuration,
	embeddedDbCfg *dbconfig.DBConfiguration,
	enforcer cost.ChainedEnforcer,
	fetchOptionsBuilder handleroptions.FetchOptionsBuilder,
	queryContextOptions models.QueryContextOptions,
	instrumentOpts instrument.Options,
	cpuProfileDuration time.Duration,
	placementServiceNames []string,
	serviceOptionDefaults []handleroptions.ServiceOptionsDefault,
	queryRouter QueryRouter,
	instantQueryRouter QueryRouter,
) (HandlerOptions, error)

NewHandlerOptions builds a handler options.

type OptionTransformFn

type OptionTransformFn func(opts HandlerOptions) HandlerOptions

OptionTransformFn transforms given handler options.

type QueryEngine

type QueryEngine string

QueryEngine is a type of query engine.

const (
	// PrometheusEngine is the prometheus query engine type.
	PrometheusEngine QueryEngine = "prometheus"
	// M3QueryEngine is M3 query engine type.
	M3QueryEngine QueryEngine = "m3query"
)

type QueryRouter added in v0.15.3

type QueryRouter interface {
	Setup(opts QueryRouterOptions)
	ServeHTTP(w http.ResponseWriter, req *http.Request)
}

QueryRouter is responsible for routing queries between promql and m3query.

type QueryRouterOptions added in v0.15.3

type QueryRouterOptions struct {
	DefaultQueryEngine QueryEngine
	PromqlHandler      func(http.ResponseWriter, *http.Request)
	M3QueryHandler     func(http.ResponseWriter, *http.Request)
}

QueryRouterOptions defines options for QueryRouter

type RemoteReadRenderer

type RemoteReadRenderer func(io.Writer, []*ts.Series,
	models.RequestParams, bool)

RemoteReadRenderer renders remote read output.

Jump to

Keyboard shortcuts

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