frontend

package
v0.0.0-...-bfa2730 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusClientClosedRequest is the status code for when a client request cancellation of an http request
	StatusClientClosedRequest = 499
	// nil response in ServeHTTP
	NilResponseError = "nil resp in ServeHTTP"
)

Variables

This section is empty.

Functions

func InitFrontend

func InitFrontend(cfg v1.Config, limits v1.Limits, log log.Logger, reg prometheus.Registerer) (http.RoundTripper, http.RoundTripper, *v1.Frontend, error)

InitFrontend initializes V1 frontend

Returned RoundTripper can be wrapped in more round-tripper middlewares, and then eventually registered into HTTP server using the Handler from this package. Returned RoundTripper is always non-nil (if there are no errors), and it uses the returned frontend (if any).

func NewDownstreamRoundTripper

func NewDownstreamRoundTripper(downstreamURL string, transport http.RoundTripper) (http.RoundTripper, error)

func NewRoundTripper

func NewRoundTripper(next http.RoundTripper, middlewares ...Middleware) http.RoundTripper

NewRoundTripper takes an ordered set of middlewares and builds a http.RoundTripper around them

Types

type Config

type Config struct {
	Config               v1.Config          `yaml:",inline"`
	MaxRetries           int                `yaml:"max_retries,omitempty"`
	TolerateFailedBlocks int                `yaml:"tolerate_failed_blocks,omitempty"`
	Search               SearchConfig       `yaml:"search"`
	SnapshotByID         SnapshotByIDConfig `yaml:"snapshot_by_id"`
}

func (*Config) RegisterFlagsAndApplyDefaults

func (cfg *Config) RegisterFlagsAndApplyDefaults(string, *flag.FlagSet)

type CortexNoQuerierLimits

type CortexNoQuerierLimits struct{}

func (CortexNoQuerierLimits) MaxQueriersPerUser

func (CortexNoQuerierLimits) MaxQueriersPerUser(string) int

type HedgingConfig

type HedgingConfig struct {
	HedgeRequestsAt   time.Duration `yaml:"hedge_requests_at"`
	HedgeRequestsUpTo int           `yaml:"hedge_requests_up_to"`
}

type Middleware

type Middleware interface {
	Wrap(http.RoundTripper) http.RoundTripper
}

Middleware is used to build pipelines of http.Roundtrippers

func MergeMiddlewares

func MergeMiddlewares(middleware ...Middleware) Middleware

MergeMiddlewares takes a set of ordered middlewares and merges them into a pipeline

type MiddlewareFunc

type MiddlewareFunc func(http.RoundTripper) http.RoundTripper

MiddlewareFunc is like http.HandlerFunc, but for Middleware.

func (MiddlewareFunc) Wrap

Wrap implements Middleware.

type QueryFrontend

type QueryFrontend struct {
	SnapshotByID, Search http.Handler

	LoadTracepointHandler http.Handler
	DelTracepointHandler  http.Handler
	// contains filtered or unexported fields
}

func New

func New(cfg Config, next http.RoundTripper, tpNext http.RoundTripper, o *overrides.Overrides, store storage.Store, logger log.Logger, registerer prometheus.Registerer) (*QueryFrontend, error)

New returns a new QueryFrontend

type RoundTripperFunc

type RoundTripperFunc func(*http.Request) (*http.Response, error)

RoundTripperFunc is like http.HandlerFunc, but for RoundTripper chosen for pipeline building over queryrange.Handler b/c of how similar queryrange.Handler is to this existing interface.

func (RoundTripperFunc) RoundTrip

func (fn RoundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implememnts http.RoundTripper

type SLOConfig

type SLOConfig struct {
	DurationSLO        time.Duration `yaml:"duration_slo,omitempty"`
	ThroughputBytesSLO float64       `yaml:"throughput_bytes_slo,omitempty"`
}

type SearchConfig

type SearchConfig struct {
	Sharder SearchSharderConfig `yaml:",inline"`
	SLO     SLOConfig           `yaml:",inline"`
}

type SearchSharderConfig

type SearchSharderConfig struct {
	ConcurrentRequests    int           `yaml:"concurrent_jobs,omitempty"`
	TargetBytesPerRequest int           `yaml:"target_bytes_per_job,omitempty"`
	DefaultLimit          uint32        `yaml:"default_result_limit"`
	MaxLimit              uint32        `yaml:"max_result_limit"`
	MaxDuration           time.Duration `yaml:"max_duration"`
	QueryBackendAfter     time.Duration `yaml:"query_backend_after,omitempty"`
	QueryIngestersUntil   time.Duration `yaml:"query_ingesters_until,omitempty"`
}

type SnapshotByIDConfig

type SnapshotByIDConfig struct {
	QueryShards int           `yaml:"query_shards,omitempty"`
	Hedging     HedgingConfig `yaml:",inline"`
	SLO         SLOConfig     `yaml:",inline"`
}

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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