Documentation ¶
Overview ¶
Package options configures query http handlers.
Index ¶
- func IsQueryEngineSet(v string) bool
- type CustomHandler
- type CustomHandlerOptions
- type GraphiteFindRouter
- type GraphiteFindRouterOptions
- type GraphiteRenderRouter
- type GraphiteRenderRouterOptions
- type HandlerOptions
- type KVStoreProtoParser
- type NamespaceValidator
- type OptionTransformFn
- type PromQLEngineFn
- type QueryEngine
- type QueryRouter
- type QueryRouterOptions
- type RemoteReadRenderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsQueryEngineSet ¶
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) // MiddlewareOverride is a function to override the global middleware configuration for the route. // If this CustomHandler is overriding an existing handler, the MiddlewareOverride for the existing handler is first // applied before applying this function. MiddlewareOverride() middleware.OverrideOptions }
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 GraphiteFindRouter ¶ added in v1.2.0
type GraphiteFindRouter interface { Setup(opts GraphiteFindRouterOptions) ServeHTTP(w http.ResponseWriter, req *http.Request) }
GraphiteFindRouter is responsible for routing graphite find queries.
type GraphiteFindRouterOptions ¶ added in v1.2.0
type GraphiteFindRouterOptions struct {
FindHandler func(http.ResponseWriter, *http.Request)
}
GraphiteFindRouterOptions defines options for graphite find router
type GraphiteRenderRouter ¶ added in v1.2.0
type GraphiteRenderRouter interface { Setup(opts GraphiteRenderRouterOptions) ServeHTTP(w http.ResponseWriter, req *http.Request) }
GraphiteRenderRouter is responsible for routing graphite render queries.
type GraphiteRenderRouterOptions ¶ added in v1.2.0
type GraphiteRenderRouterOptions struct {
RenderHandler func(http.ResponseWriter, *http.Request)
}
GraphiteRenderRouterOptions defines options for the graphite render router.
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 // PrometheusEngineFn returns the function for Prometheus engine creation. PrometheusEngineFn() PromQLEngineFn // SetPrometheusEngineFn sets the function for Prometheus engine creation. SetPrometheusEngineFn(fn PromQLEngineFn) 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 // ServiceOptionDefaults returns the service option defaults. ServiceOptionDefaults() []placementhandleroptions.ServiceOptionsDefault // SetServiceOptionDefaults sets the service option defaults. SetServiceOptionDefaults(s []placementhandleroptions.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 // GraphiteFindFetchOptionsBuilder returns the Graphite find fetch options builder. GraphiteFindFetchOptionsBuilder() handleroptions.FetchOptionsBuilder // SetGraphiteFindFetchOptionsBuilder sets the Graphite find fetch options builder. SetGraphiteFindFetchOptionsBuilder(value handleroptions.FetchOptionsBuilder) HandlerOptions // GraphiteRenderFetchOptionsBuilder returns the Graphite render fetch options builder. GraphiteRenderFetchOptionsBuilder() handleroptions.FetchOptionsBuilder // SetGraphiteRenderFetchOptionsBuilder sets the Graphite render fetch options builder. SetGraphiteRenderFetchOptionsBuilder(value handleroptions.FetchOptionsBuilder) HandlerOptions // GraphiteRenderRouter is a reference to the router for graphite render queries. GraphiteRenderRouter() GraphiteRenderRouter // SetGraphiteRenderRouter sets the graphite render router. SetGraphiteRenderRouter(value GraphiteRenderRouter) HandlerOptions // GraphiteFindRouter is a reference to the router for graphite find queries. GraphiteFindRouter() GraphiteFindRouter // SetGraphiteFindRouter sets the graphite find router. SetGraphiteFindRouter(value GraphiteFindRouter) HandlerOptions // SetM3DBOptions sets the M3DB options. SetM3DBOptions(value m3.Options) HandlerOptions // M3DBOptions returns the M3DB options. M3DBOptions() m3.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 // SetKVStoreProtoParser sets the KVStoreProtoParser. SetKVStoreProtoParser(KVStoreProtoParser) HandlerOptions // KVStoreProtoParser returns the KVStoreProtoParser. KVStoreProtoParser() KVStoreProtoParser // SetRegisterMiddleware sets the function to construct the set of Middleware functions to run. SetRegisterMiddleware(value middleware.Register) HandlerOptions // RegisterMiddleware returns the function to construct the set of Middleware functions to run. RegisterMiddleware() middleware.Register // DefaultLookback returns the default value of lookback duration. DefaultLookback() time.Duration // SetDefaultLookback sets the default value of lookback duration. SetDefaultLookback(value time.Duration) 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, prometheusEngineFn PromQLEngineFn, m3dbClusters m3.Clusters, clusterClient clusterclient.Client, cfg config.Configuration, embeddedDBCfg *dbconfig.DBConfiguration, fetchOptionsBuilder handleroptions.FetchOptionsBuilder, graphiteFindFetchOptionsBuilder handleroptions.FetchOptionsBuilder, graphiteRenderFetchOptionsBuilder handleroptions.FetchOptionsBuilder, queryContextOptions models.QueryContextOptions, instrumentOpts instrument.Options, cpuProfileDuration time.Duration, serviceOptionDefaults []placementhandleroptions.ServiceOptionsDefault, queryRouter QueryRouter, instantQueryRouter QueryRouter, graphiteStorageOpts graphite.M3WrappedStorageOptions, m3dbOpts m3.Options, graphiteRenderRouter GraphiteRenderRouter, graphiteFindRouter GraphiteFindRouter, defaultLookback time.Duration, ) (HandlerOptions, error)
NewHandlerOptions builds a handler options.
type KVStoreProtoParser ¶ added in v1.2.0
type KVStoreProtoParser func(key string) (protoiface.MessageV1, error)
KVStoreProtoParser parses protobuf messages based off specific keys.
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 PromQLEngineFn ¶ added in v1.4.0
PromQLEngineFn constructs promql.Engine with the given lookbackDuration. promql.Engine uses a fixed lookback, so we have to create multiple engines for different lookback values.
TODO(vilius): there's a conversation at Prometheus mailing list about making lookback dynamic
https://groups.google.com/g/prometheus-developers/c/9wzuobfLMV8
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 ¶
RemoteReadRenderer renders remote read output.