options

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 21 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.
	// prev is optional argument for getting already registered handler for the same route.
	// If there is nothing to override, prev will be nil.
	Handler(handlerOptions HandlerOptions, prev http.Handler) (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

	// 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

	// GraphiteStorageOptions returns the Graphite storage options.
	GraphiteStorageOptions() graphite.M3WrappedStorageOptions
	// SetGraphiteStorageOptions sets the Graphite storage options.
	SetGraphiteStorageOptions(value graphite.M3WrappedStorageOptions) HandlerOptions

	// SetM3DBOptions sets the M3DB options.
	SetM3DBOptions(value m3db.Options) HandlerOptions
	// M3DBOptions returns the M3DB options.
	M3DBOptions() m3db.Options

	// SetStoreMetricsType enables/disables storing of metrics type.
	SetStoreMetricsType(value bool) HandlerOptions
	// StoreMetricsType returns true if storing of metrics type is enabled.
	StoreMetricsType() bool

	// SetNamespaceValidator sets the NamespaceValidator.
	SetNamespaceValidator(NamespaceValidator) HandlerOptions
	// NamespaceValidator returns the NamespaceValidator.
	NamespaceValidator() NamespaceValidator
}

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,
	fetchOptionsBuilder handleroptions.FetchOptionsBuilder,
	queryContextOptions models.QueryContextOptions,
	instrumentOpts instrument.Options,
	cpuProfileDuration time.Duration,
	placementServiceNames []string,
	serviceOptionDefaults []handleroptions.ServiceOptionsDefault,
	queryRouter QueryRouter,
	instantQueryRouter QueryRouter,
	graphiteStorageOpts graphite.M3WrappedStorageOptions,
	m3dbOpts m3db.Options,
) (HandlerOptions, error)

NewHandlerOptions builds a handler options.

type NamespaceValidator added in v1.0.1

type NamespaceValidator interface {
	// ValidateNewNamespace gets invoked when creating a new namespace.
	ValidateNewNamespace(newNs dbnamespace.Metadata, existing []dbnamespace.Metadata) error
}

NamespaceValidator defines namespace validation logics.

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