queryfrontend

package
v0.23.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 44 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthResponse        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowResponse          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupResponse = fmt.Errorf("proto: unexpected end of group")
)

Functions

func DownsampledMiddleware added in v0.19.0

func DownsampledMiddleware(merger queryrange.Merger, registerer prometheus.Registerer) queryrange.Middleware

DownsampledMiddleware creates a new Middleware that requests downsampled data should response to original request with auto max_source_resolution not contain data points.

func NewCacheConfig added in v0.16.0

func NewCacheConfig(logger log.Logger, confContentYaml []byte) (*cortexcache.Config, error)

NewCacheConfig is a parser that converts a Thanos cache config yaml into a cortex cache config struct.

func NewThanosLabelsCodec added in v0.17.0

func NewThanosLabelsCodec(partialResponse bool, defaultMetadataTimeRange time.Duration) *labelsCodec

NewThanosLabelsCodec initializes a labelsCodec.

func NewThanosQueryRangeCodec added in v0.17.0

func NewThanosQueryRangeCodec(partialResponse bool) *queryRangeCodec

NewThanosQueryRangeCodec initializes a queryRangeCodec.

func NewTripperware added in v0.16.0

func NewTripperware(config Config, reg prometheus.Registerer, logger log.Logger) (queryrange.Tripperware, error)

NewTripperware returns a Tripperware which sends requests to different sub tripperwares based on the query type.

func SplitByIntervalMiddleware added in v0.17.0

func SplitByIntervalMiddleware(interval queryrange.IntervalFn, limits queryrange.Limits, merger queryrange.Merger, registerer prometheus.Registerer) queryrange.Middleware

SplitByIntervalMiddleware creates a new Middleware that splits requests by a given interval.

Types

type CacheProviderConfig added in v0.16.0

type CacheProviderConfig struct {
	Type   ResponseCacheProvider `yaml:"type"`
	Config interface{}           `yaml:"config"`
}

CacheProviderConfig is the initial CacheProviderConfig struct holder before parsing it into a specific cache provider. Based on the config type the config is then parsed into a specific cache provider.

type Config added in v0.16.0

type Config struct {
	QueryRangeConfig
	LabelsConfig
	DownstreamTripperConfig

	CortexHandlerConfig    *transport.HandlerConfig
	CompressResponses      bool
	CacheCompression       string
	RequestLoggingDecision string
	DownstreamURL          string
}

Config holds the query frontend configs.

func (*Config) Validate added in v0.16.0

func (cfg *Config) Validate() error

Validate a fully initialized config.

type DownstreamTripperConfig added in v0.23.0

type DownstreamTripperConfig struct {
	IdleConnTimeout       prommodel.Duration `yaml:"idle_conn_timeout"`
	ResponseHeaderTimeout prommodel.Duration `yaml:"response_header_timeout"`
	TLSHandshakeTimeout   prommodel.Duration `yaml:"tls_handshake_timeout"`
	ExpectContinueTimeout prommodel.Duration `yaml:"expect_continue_timeout"`
	MaxIdleConns          *int               `yaml:"max_idle_conns"`
	MaxIdleConnsPerHost   *int               `yaml:"max_idle_conns_per_host"`
	MaxConnsPerHost       *int               `yaml:"max_conns_per_host"`

	CachePathOrContent extflag.PathOrContent
}

DownstreamTripperConfig stores the http.Transport configuration for query-frontend's HTTP downstream tripper.

type InMemoryResponseCacheConfig added in v0.16.0

type InMemoryResponseCacheConfig struct {
	// MaxSize represents overall maximum number of bytes cache can contain.
	MaxSize string `yaml:"max_size"`
	// MaxSizeItems represents the maximum number of entries in the cache.
	MaxSizeItems int `yaml:"max_size_items"`
	// Validity represents the expiry duration for the cache.
	Validity time.Duration `yaml:"validity"`
}

InMemoryResponseCacheConfig holds the configs for the in-memory cache provider.

type LabelsConfig added in v0.17.0

type LabelsConfig struct {
	// PartialResponseStrategy is the default strategy used
	// when parsing thanos query request.
	PartialResponseStrategy bool
	DefaultTimeRange        time.Duration

	ResultsCacheConfig *queryrange.ResultsCacheConfig
	CachePathOrContent extflag.PathOrContent

	SplitQueriesByInterval time.Duration
	MaxRetries             int

	Limits *cortexvalidation.Limits
}

LabelsConfig holds the config for labels tripperware.

type MemcachedResponseCacheConfig added in v0.16.0

type MemcachedResponseCacheConfig struct {
	Memcached cacheutil.MemcachedClientConfig `yaml:",inline"`
	// Expiration sets a global expiration limit for all cached items.
	Expiration time.Duration `yaml:"expiration"`
}

MemcachedResponseCacheConfig holds the configs for the memcache cache provider.

type QueryRangeConfig added in v0.17.0

type QueryRangeConfig struct {
	// PartialResponseStrategy is the default strategy used
	// when parsing thanos query request.
	PartialResponseStrategy bool

	ResultsCacheConfig *queryrange.ResultsCacheConfig
	CachePathOrContent extflag.PathOrContent

	AlignRangeWithStep     bool
	RequestDownsampled     bool
	SplitQueriesByInterval time.Duration
	MaxRetries             int
	Limits                 *cortexvalidation.Limits
}

QueryRangeConfig holds the config for query range tripperware.

type ResponseCacheProvider added in v0.16.0

type ResponseCacheProvider string
const (
	INMEMORY  ResponseCacheProvider = "IN-MEMORY"
	MEMCACHED ResponseCacheProvider = "MEMCACHED"
)

type ResponseHeader added in v0.17.0

type ResponseHeader struct {
	Name   string   `protobuf:"bytes,1,opt,name=Name,proto3" json:"-"`
	Values []string `protobuf:"bytes,2,rep,name=Values,proto3" json:"-"`
}

func (*ResponseHeader) Descriptor added in v0.17.0

func (*ResponseHeader) Descriptor() ([]byte, []int)

func (*ResponseHeader) Marshal added in v0.17.0

func (m *ResponseHeader) Marshal() (dAtA []byte, err error)

func (*ResponseHeader) MarshalTo added in v0.17.0

func (m *ResponseHeader) MarshalTo(dAtA []byte) (int, error)

func (*ResponseHeader) MarshalToSizedBuffer added in v0.17.0

func (m *ResponseHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ResponseHeader) ProtoMessage added in v0.17.0

func (*ResponseHeader) ProtoMessage()

func (*ResponseHeader) Reset added in v0.17.0

func (m *ResponseHeader) Reset()

func (*ResponseHeader) Size added in v0.17.0

func (m *ResponseHeader) Size() (n int)

func (*ResponseHeader) String added in v0.17.0

func (m *ResponseHeader) String() string

func (*ResponseHeader) Unmarshal added in v0.17.0

func (m *ResponseHeader) Unmarshal(dAtA []byte) error

func (*ResponseHeader) XXX_DiscardUnknown added in v0.17.0

func (m *ResponseHeader) XXX_DiscardUnknown()

func (*ResponseHeader) XXX_Marshal added in v0.17.0

func (m *ResponseHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ResponseHeader) XXX_Merge added in v0.17.0

func (m *ResponseHeader) XXX_Merge(src proto.Message)

func (*ResponseHeader) XXX_Size added in v0.17.0

func (m *ResponseHeader) XXX_Size() int

func (*ResponseHeader) XXX_Unmarshal added in v0.17.0

func (m *ResponseHeader) XXX_Unmarshal(b []byte) error

type ThanosLabelsRequest added in v0.17.0

type ThanosLabelsRequest struct {
	Start           int64
	End             int64
	Label           string
	Path            string
	Matchers        [][]*labels.Matcher
	StoreMatchers   [][]*labels.Matcher
	PartialResponse bool
	CachingOptions  queryrange.CachingOptions
}

func (*ThanosLabelsRequest) GetCachingOptions added in v0.17.0

func (r *ThanosLabelsRequest) GetCachingOptions() queryrange.CachingOptions

func (*ThanosLabelsRequest) GetEnd added in v0.17.0

func (r *ThanosLabelsRequest) GetEnd() int64

GetEnd returns the end timestamp of the request in milliseconds.

func (*ThanosLabelsRequest) GetQuery added in v0.17.0

func (r *ThanosLabelsRequest) GetQuery() string

GetQuery returns the query of the request.

func (*ThanosLabelsRequest) GetStart added in v0.17.0

func (r *ThanosLabelsRequest) GetStart() int64

GetStart returns the start timestamp of the request in milliseconds.

func (*ThanosLabelsRequest) GetStep added in v0.17.0

func (r *ThanosLabelsRequest) GetStep() int64

GetStep returns the step of the request in milliseconds. Returns 1 is a trick to avoid panic in https://github.com/cortexproject/cortex/blob/master/pkg/querier/queryrange/results_cache.go#L447.

func (*ThanosLabelsRequest) GetStoreMatchers added in v0.17.0

func (r *ThanosLabelsRequest) GetStoreMatchers() [][]*labels.Matcher

func (*ThanosLabelsRequest) LogToSpan added in v0.17.0

func (r *ThanosLabelsRequest) LogToSpan(sp opentracing.Span)

LogToSpan writes information about this request to an OpenTracing span.

func (*ThanosLabelsRequest) ProtoMessage added in v0.17.0

func (r *ThanosLabelsRequest) ProtoMessage()

ProtoMessage implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosLabelsRequest) Reset added in v0.17.0

func (r *ThanosLabelsRequest) Reset()

Reset implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosLabelsRequest) String added in v0.17.0

func (r *ThanosLabelsRequest) String() string

String implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosLabelsRequest) WithQuery added in v0.17.0

func (r *ThanosLabelsRequest) WithQuery(_ string) queryrange.Request

WithQuery clone the current request with a different query.

func (*ThanosLabelsRequest) WithStartEnd added in v0.17.0

func (r *ThanosLabelsRequest) WithStartEnd(start, end int64) queryrange.Request

WithStartEnd clone the current request with different start and end timestamp.

type ThanosLabelsResponse added in v0.17.0

type ThanosLabelsResponse struct {
	Status    string            `protobuf:"bytes,1,opt,name=Status,proto3" json:"status"`
	Data      []string          `protobuf:"bytes,2,rep,name=Data,proto3" json:"data"`
	ErrorType string            `protobuf:"bytes,3,opt,name=ErrorType,proto3" json:"errorType,omitempty"`
	Error     string            `protobuf:"bytes,4,opt,name=Error,proto3" json:"error,omitempty"`
	Headers   []*ResponseHeader `protobuf:"bytes,5,rep,name=Headers,proto3" json:"-"`
}

func (*ThanosLabelsResponse) Descriptor added in v0.17.0

func (*ThanosLabelsResponse) Descriptor() ([]byte, []int)

func (*ThanosLabelsResponse) GetHeaders added in v0.17.0

GetHeaders returns the HTTP headers in the response.

func (*ThanosLabelsResponse) Marshal added in v0.17.0

func (m *ThanosLabelsResponse) Marshal() (dAtA []byte, err error)

func (*ThanosLabelsResponse) MarshalTo added in v0.17.0

func (m *ThanosLabelsResponse) MarshalTo(dAtA []byte) (int, error)

func (*ThanosLabelsResponse) MarshalToSizedBuffer added in v0.17.0

func (m *ThanosLabelsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ThanosLabelsResponse) ProtoMessage added in v0.17.0

func (*ThanosLabelsResponse) ProtoMessage()

func (*ThanosLabelsResponse) Reset added in v0.17.0

func (m *ThanosLabelsResponse) Reset()

func (*ThanosLabelsResponse) Size added in v0.17.0

func (m *ThanosLabelsResponse) Size() (n int)

func (*ThanosLabelsResponse) String added in v0.17.0

func (m *ThanosLabelsResponse) String() string

func (*ThanosLabelsResponse) Unmarshal added in v0.17.0

func (m *ThanosLabelsResponse) Unmarshal(dAtA []byte) error

func (*ThanosLabelsResponse) XXX_DiscardUnknown added in v0.17.0

func (m *ThanosLabelsResponse) XXX_DiscardUnknown()

func (*ThanosLabelsResponse) XXX_Marshal added in v0.17.0

func (m *ThanosLabelsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ThanosLabelsResponse) XXX_Merge added in v0.17.0

func (m *ThanosLabelsResponse) XXX_Merge(src proto.Message)

func (*ThanosLabelsResponse) XXX_Size added in v0.17.0

func (m *ThanosLabelsResponse) XXX_Size() int

func (*ThanosLabelsResponse) XXX_Unmarshal added in v0.17.0

func (m *ThanosLabelsResponse) XXX_Unmarshal(b []byte) error

type ThanosQueryRangeRequest added in v0.17.0

type ThanosQueryRangeRequest struct {
	Path                string
	Start               int64
	End                 int64
	Step                int64
	Timeout             time.Duration
	Query               string
	Dedup               bool
	PartialResponse     bool
	AutoDownsampling    bool
	MaxSourceResolution int64
	ReplicaLabels       []string
	StoreMatchers       [][]*labels.Matcher
	CachingOptions      queryrange.CachingOptions
}

func (*ThanosQueryRangeRequest) GetCachingOptions added in v0.17.0

func (r *ThanosQueryRangeRequest) GetCachingOptions() queryrange.CachingOptions

func (*ThanosQueryRangeRequest) GetEnd added in v0.17.0

func (r *ThanosQueryRangeRequest) GetEnd() int64

GetEnd returns the end timestamp of the request in milliseconds.

func (*ThanosQueryRangeRequest) GetQuery added in v0.17.0

func (r *ThanosQueryRangeRequest) GetQuery() string

GetQuery returns the query of the request.

func (*ThanosQueryRangeRequest) GetStart added in v0.17.0

func (r *ThanosQueryRangeRequest) GetStart() int64

GetStart returns the start timestamp of the request in milliseconds.

func (*ThanosQueryRangeRequest) GetStep added in v0.17.0

func (r *ThanosQueryRangeRequest) GetStep() int64

GetStep returns the step of the request in milliseconds.

func (*ThanosQueryRangeRequest) GetStoreMatchers added in v0.17.0

func (r *ThanosQueryRangeRequest) GetStoreMatchers() [][]*labels.Matcher

func (*ThanosQueryRangeRequest) LogToSpan added in v0.17.0

func (r *ThanosQueryRangeRequest) LogToSpan(sp opentracing.Span)

LogToSpan writes information about this request to an OpenTracing span.

func (*ThanosQueryRangeRequest) ProtoMessage added in v0.17.0

func (r *ThanosQueryRangeRequest) ProtoMessage()

ProtoMessage implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosQueryRangeRequest) Reset added in v0.17.0

func (r *ThanosQueryRangeRequest) Reset()

Reset implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosQueryRangeRequest) String added in v0.17.0

func (r *ThanosQueryRangeRequest) String() string

String implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosQueryRangeRequest) WithQuery added in v0.17.0

func (r *ThanosQueryRangeRequest) WithQuery(query string) queryrange.Request

WithQuery clone the current request with a different query.

func (*ThanosQueryRangeRequest) WithStartEnd added in v0.17.0

func (r *ThanosQueryRangeRequest) WithStartEnd(start, end int64) queryrange.Request

WithStartEnd clone the current request with different start and end timestamp.

type ThanosRequest

type ThanosRequest interface {
	GetStoreMatchers() [][]*labels.Matcher
}

TODO(yeya24): add partial result when needed. ThanosRequest is a common interface defined for specific thanos requests.

type ThanosResponseExtractor added in v0.17.0

type ThanosResponseExtractor struct{}

ThanosResponseExtractor helps extracting specific info from Query Response.

func (ThanosResponseExtractor) Extract added in v0.17.0

Extract extracts response for specific a range from a response. This interface is not used for labels and series responses.

func (ThanosResponseExtractor) ResponseWithoutHeaders added in v0.17.0

func (ThanosResponseExtractor) ResponseWithoutHeaders(resp queryrange.Response) queryrange.Response

ResponseWithoutHeaders returns the response without HTTP headers.

type ThanosSeriesRequest added in v0.17.0

type ThanosSeriesRequest struct {
	Path            string
	Start           int64
	End             int64
	Dedup           bool
	PartialResponse bool
	ReplicaLabels   []string
	Matchers        [][]*labels.Matcher
	StoreMatchers   [][]*labels.Matcher
	CachingOptions  queryrange.CachingOptions
}

func (*ThanosSeriesRequest) GetCachingOptions added in v0.17.0

func (r *ThanosSeriesRequest) GetCachingOptions() queryrange.CachingOptions

func (*ThanosSeriesRequest) GetEnd added in v0.17.0

func (r *ThanosSeriesRequest) GetEnd() int64

GetEnd returns the end timestamp of the request in milliseconds.

func (*ThanosSeriesRequest) GetQuery added in v0.17.0

func (r *ThanosSeriesRequest) GetQuery() string

GetQuery returns the query of the request.

func (*ThanosSeriesRequest) GetStart added in v0.17.0

func (r *ThanosSeriesRequest) GetStart() int64

GetStart returns the start timestamp of the request in milliseconds.

func (*ThanosSeriesRequest) GetStep added in v0.17.0

func (r *ThanosSeriesRequest) GetStep() int64

GetStep returns the step of the request in milliseconds. Returns 1 is a trick to avoid panic in https://github.com/cortexproject/cortex/blob/master/pkg/querier/queryrange/results_cache.go#L447.

func (*ThanosSeriesRequest) GetStoreMatchers added in v0.17.0

func (r *ThanosSeriesRequest) GetStoreMatchers() [][]*labels.Matcher

func (*ThanosSeriesRequest) LogToSpan added in v0.17.0

func (r *ThanosSeriesRequest) LogToSpan(sp opentracing.Span)

LogToSpan writes information about this request to an OpenTracing span.

func (*ThanosSeriesRequest) ProtoMessage added in v0.17.0

func (r *ThanosSeriesRequest) ProtoMessage()

ProtoMessage implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosSeriesRequest) Reset added in v0.17.0

func (r *ThanosSeriesRequest) Reset()

Reset implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosSeriesRequest) String added in v0.17.0

func (r *ThanosSeriesRequest) String() string

String implements proto.Message interface required by queryrange.Request, which is not used in thanos.

func (*ThanosSeriesRequest) WithQuery added in v0.17.0

func (r *ThanosSeriesRequest) WithQuery(_ string) queryrange.Request

WithQuery clone the current request with a different query.

func (*ThanosSeriesRequest) WithStartEnd added in v0.17.0

func (r *ThanosSeriesRequest) WithStartEnd(start, end int64) queryrange.Request

WithStartEnd clone the current request with different start and end timestamp.

type ThanosSeriesResponse added in v0.17.0

type ThanosSeriesResponse struct {
	Status    string              `protobuf:"bytes,1,opt,name=Status,proto3" json:"status"`
	Data      []labelpb.ZLabelSet `protobuf:"bytes,2,rep,name=Data,proto3" json:"data"`
	ErrorType string              `protobuf:"bytes,3,opt,name=ErrorType,proto3" json:"errorType,omitempty"`
	Error     string              `protobuf:"bytes,4,opt,name=Error,proto3" json:"error,omitempty"`
	Headers   []*ResponseHeader   `protobuf:"bytes,5,rep,name=Headers,proto3" json:"-"`
}

func (*ThanosSeriesResponse) Descriptor added in v0.17.0

func (*ThanosSeriesResponse) Descriptor() ([]byte, []int)

func (*ThanosSeriesResponse) GetHeaders added in v0.17.0

GetHeaders returns the HTTP headers in the response.

func (*ThanosSeriesResponse) Marshal added in v0.17.0

func (m *ThanosSeriesResponse) Marshal() (dAtA []byte, err error)

func (*ThanosSeriesResponse) MarshalTo added in v0.17.0

func (m *ThanosSeriesResponse) MarshalTo(dAtA []byte) (int, error)

func (*ThanosSeriesResponse) MarshalToSizedBuffer added in v0.17.0

func (m *ThanosSeriesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ThanosSeriesResponse) ProtoMessage added in v0.17.0

func (*ThanosSeriesResponse) ProtoMessage()

func (*ThanosSeriesResponse) Reset added in v0.17.0

func (m *ThanosSeriesResponse) Reset()

func (*ThanosSeriesResponse) Size added in v0.17.0

func (m *ThanosSeriesResponse) Size() (n int)

func (*ThanosSeriesResponse) String added in v0.17.0

func (m *ThanosSeriesResponse) String() string

func (*ThanosSeriesResponse) Unmarshal added in v0.17.0

func (m *ThanosSeriesResponse) Unmarshal(dAtA []byte) error

func (*ThanosSeriesResponse) XXX_DiscardUnknown added in v0.17.0

func (m *ThanosSeriesResponse) XXX_DiscardUnknown()

func (*ThanosSeriesResponse) XXX_Marshal added in v0.17.0

func (m *ThanosSeriesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ThanosSeriesResponse) XXX_Merge added in v0.17.0

func (m *ThanosSeriesResponse) XXX_Merge(src proto.Message)

func (*ThanosSeriesResponse) XXX_Size added in v0.17.0

func (m *ThanosSeriesResponse) XXX_Size() int

func (*ThanosSeriesResponse) XXX_Unmarshal added in v0.17.0

func (m *ThanosSeriesResponse) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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