querymiddleware

package
v0.0.0-...-748a726 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 75 Imported by: 4

Documentation

Index

Constants

View Source
const (

	// DefaultDeprecatedAlignQueriesWithStep is the default value for the deprecated querier frontend config DeprecatedAlignQueriesWithStep
	// which has been moved to a per-tenant limit; TODO remove in Mimir 2.14
	DefaultDeprecatedAlignQueriesWithStep = false
)

Variables

View Source
var (
	ErrInvalidLengthModel = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowModel   = fmt.Errorf("proto: integer overflow")
)
View Source
var ErrUnsupportedRequest = errors.New("request is not cacheable")

ErrUnsupportedRequest is intended to be used with CacheKeyGenerator

Functions

func DecodeCachedHTTPResponse

func DecodeCachedHTTPResponse(res *CachedHTTPResponse) *http.Response

func DecodeInstantQueryTimeParams

func DecodeInstantQueryTimeParams(reqValues *url.Values, defaultNow func() time.Time) (time int64, err error)

DecodeInstantQueryTimeParams encapsulates Prometheus instant query time param parsing, emulating the logic in prometheus/prometheus/web/api/v1#API.query.

func DecodeLabelsQueryTimeParams

func DecodeLabelsQueryTimeParams(reqValues *url.Values, usePromDefaults bool) (start, end int64, err error)

DecodeLabelsQueryTimeParams encapsulates Prometheus label names and label values query time param parsing, emulating the logic in prometheus/prometheus/web/api/v1#API.labelNames and v1#API.labelValues.

Setting `usePromDefaults` true will set missing timestamp params to the Prometheus default min and max query timestamps; false will default to 0 for missing timestamp params.

func DecodeRangeQueryTimeParams

func DecodeRangeQueryTimeParams(reqValues *url.Values) (start, end, step int64, err error)

DecodeRangeQueryTimeParams encapsulates Prometheus instant query time param parsing, emulating the logic in prometheus/prometheus/web/api/v1#API.query_range.

func IsActiveSeriesQuery

func IsActiveSeriesQuery(path string) bool

func IsCardinalityQuery

func IsCardinalityQuery(path string) bool

func IsInstantQuery

func IsInstantQuery(path string) bool

func IsLabelNamesQuery

func IsLabelNamesQuery(path string) bool

func IsLabelValuesQuery

func IsLabelValuesQuery(path string) bool

func IsLabelsQuery

func IsLabelsQuery(path string) bool

func IsRangeQuery

func IsRangeQuery(path string) bool

func NewFrontendRunningRoundTripper

func NewFrontendRunningRoundTripper(next http.RoundTripper, service services.Service, timeout time.Duration, log log.Logger) http.RoundTripper

Types

type CacheKeyGenerator

type CacheKeyGenerator interface {
	// QueryRequest should generate a cache key based on the tenant ID and MetricsQueryRequest.
	QueryRequest(ctx context.Context, tenantID string, r MetricsQueryRequest) string

	// LabelValues should return a cache key for a label values request. The cache key does not need to contain the tenant ID.
	// LabelValues can return ErrUnsupportedRequest, in which case the response won't be treated as an error, but the item will still not be cached.
	// LabelValues should return a nil *GenericQueryCacheKey when it returns an error and
	// should always return non-nil *GenericQueryCacheKey when the returned error is nil.
	LabelValues(r *http.Request) (*GenericQueryCacheKey, error)

	// LabelValuesCardinality should return a cache key for a label values cardinality request. The cache key does not need to contain the tenant ID.
	// LabelValuesCardinality can return ErrUnsupportedRequest, in which case the response won't be treated as an error, but the item will still not be cached.
	// LabelValuesCardinality should return a nil *GenericQueryCacheKey when it returns an error and
	// should always return non-nil *GenericQueryCacheKey when the returned error is nil.
	LabelValuesCardinality(r *http.Request) (*GenericQueryCacheKey, error)
}

CacheKeyGenerator generates cache keys. This is a useful interface for downstream consumers who wish to implement their own strategies.

type CachedHTTPHeader

type CachedHTTPHeader struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

CachedHTTPHeader holds a HTTP header.

func (*CachedHTTPHeader) Descriptor

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

func (*CachedHTTPHeader) Equal

func (this *CachedHTTPHeader) Equal(that interface{}) bool

func (*CachedHTTPHeader) GetName

func (m *CachedHTTPHeader) GetName() string

func (*CachedHTTPHeader) GetValue

func (m *CachedHTTPHeader) GetValue() string

func (*CachedHTTPHeader) GoString

func (this *CachedHTTPHeader) GoString() string

func (*CachedHTTPHeader) Marshal

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

func (*CachedHTTPHeader) MarshalTo

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

func (*CachedHTTPHeader) MarshalToSizedBuffer

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

func (*CachedHTTPHeader) ProtoMessage

func (*CachedHTTPHeader) ProtoMessage()

func (*CachedHTTPHeader) Reset

func (m *CachedHTTPHeader) Reset()

func (*CachedHTTPHeader) Size

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

func (*CachedHTTPHeader) String

func (this *CachedHTTPHeader) String() string

func (*CachedHTTPHeader) Unmarshal

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

func (*CachedHTTPHeader) XXX_DiscardUnknown

func (m *CachedHTTPHeader) XXX_DiscardUnknown()

func (*CachedHTTPHeader) XXX_Marshal

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

func (*CachedHTTPHeader) XXX_Merge

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

func (*CachedHTTPHeader) XXX_Size

func (m *CachedHTTPHeader) XXX_Size() int

func (*CachedHTTPHeader) XXX_Unmarshal

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

type CachedHTTPResponse

type CachedHTTPResponse struct {
	// cacheKey contains the non-hashed cache key, used to guarantee there haven't
	// been any hashed cache key collision.
	CacheKey string `protobuf:"bytes,1,opt,name=cache_key,json=cacheKey,proto3" json:"cache_key,omitempty"`
	// statusCode contains the HTTP response status code.
	StatusCode int32 `protobuf:"varint,2,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
	// headers contains the HTTP response headers.
	Headers []*CachedHTTPHeader `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"`
	// body contains the HTTP response body.
	Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
}

CachedHTTPResponse holds a generic HTTP response in the query results cache.

func EncodeCachedHTTPResponse

func EncodeCachedHTTPResponse(cacheKey string, res *http.Response) (*CachedHTTPResponse, error)

EncodeCachedHTTPResponse encodes the input http.Response into CachedHTTPResponse. The input res.Body is replaced in this function, so that it can be safely consumed again.

func (*CachedHTTPResponse) Descriptor

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

func (*CachedHTTPResponse) Equal

func (this *CachedHTTPResponse) Equal(that interface{}) bool

func (*CachedHTTPResponse) GetBody

func (m *CachedHTTPResponse) GetBody() []byte

func (*CachedHTTPResponse) GetCacheKey

func (m *CachedHTTPResponse) GetCacheKey() string

func (*CachedHTTPResponse) GetHeaders

func (m *CachedHTTPResponse) GetHeaders() []*CachedHTTPHeader

func (*CachedHTTPResponse) GetStatusCode

func (m *CachedHTTPResponse) GetStatusCode() int32

func (*CachedHTTPResponse) GoString

func (this *CachedHTTPResponse) GoString() string

func (*CachedHTTPResponse) Marshal

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

func (*CachedHTTPResponse) MarshalTo

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

func (*CachedHTTPResponse) MarshalToSizedBuffer

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

func (*CachedHTTPResponse) ProtoMessage

func (*CachedHTTPResponse) ProtoMessage()

func (*CachedHTTPResponse) Reset

func (m *CachedHTTPResponse) Reset()

func (*CachedHTTPResponse) Size

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

func (*CachedHTTPResponse) String

func (this *CachedHTTPResponse) String() string

func (*CachedHTTPResponse) Unmarshal

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

func (*CachedHTTPResponse) XXX_DiscardUnknown

func (m *CachedHTTPResponse) XXX_DiscardUnknown()

func (*CachedHTTPResponse) XXX_Marshal

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

func (*CachedHTTPResponse) XXX_Merge

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

func (*CachedHTTPResponse) XXX_Size

func (m *CachedHTTPResponse) XXX_Size() int

func (*CachedHTTPResponse) XXX_Unmarshal

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

type CachedResponse

type CachedResponse struct {
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key"`
	// List of cached responses; non-overlapping and in order.
	Extents []Extent `protobuf:"bytes,2,rep,name=extents,proto3" json:"extents"`
}

func (*CachedResponse) Descriptor

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

func (*CachedResponse) Equal

func (this *CachedResponse) Equal(that interface{}) bool

func (*CachedResponse) GetExtents

func (m *CachedResponse) GetExtents() []Extent

func (*CachedResponse) GetKey

func (m *CachedResponse) GetKey() string

func (*CachedResponse) GoString

func (this *CachedResponse) GoString() string

func (*CachedResponse) Marshal

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

func (*CachedResponse) MarshalTo

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

func (*CachedResponse) MarshalToSizedBuffer

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

func (*CachedResponse) ProtoMessage

func (*CachedResponse) ProtoMessage()

func (*CachedResponse) Reset

func (m *CachedResponse) Reset()

func (*CachedResponse) Size

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

func (*CachedResponse) String

func (this *CachedResponse) String() string

func (*CachedResponse) Unmarshal

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

func (*CachedResponse) XXX_DiscardUnknown

func (m *CachedResponse) XXX_DiscardUnknown()

func (*CachedResponse) XXX_Marshal

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

func (*CachedResponse) XXX_Merge

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

func (*CachedResponse) XXX_Size

func (m *CachedResponse) XXX_Size() int

func (*CachedResponse) XXX_Unmarshal

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

type Codec

type Codec interface {
	Merger
	// DecodeMetricsQueryRequest decodes a MetricsQueryRequest from an http request.
	DecodeMetricsQueryRequest(context.Context, *http.Request) (MetricsQueryRequest, error)
	// DecodeLabelsQueryRequest decodes a LabelsQueryRequest from an http request.
	DecodeLabelsQueryRequest(context.Context, *http.Request) (LabelsQueryRequest, error)
	// DecodeResponse decodes a Response from an http response.
	// The original request is also passed as a parameter this is useful for implementation that needs the request
	// to merge result or build the result correctly.
	DecodeResponse(context.Context, *http.Response, MetricsQueryRequest, log.Logger) (Response, error)
	// EncodeMetricsQueryRequest encodes a MetricsQueryRequest into an http request.
	EncodeMetricsQueryRequest(context.Context, MetricsQueryRequest) (*http.Request, error)
	// EncodeLabelsQueryRequest encodes a LabelsQueryRequest into an http request.
	EncodeLabelsQueryRequest(context.Context, LabelsQueryRequest) (*http.Request, error)
	// EncodeResponse encodes a Response into an http response.
	EncodeResponse(context.Context, *http.Request, Response) (*http.Response, error)
}

Codec is used to encode/decode query requests and responses so they can be passed down to middlewares.

func NewPrometheusCodec

func NewPrometheusCodec(registerer prometheus.Registerer, queryResultResponseFormat string) Codec

type Config

type Config struct {
	SplitQueriesByInterval         time.Duration `yaml:"split_queries_by_interval" category:"advanced"`
	DeprecatedAlignQueriesWithStep bool          `yaml:"align_queries_with_step" doc:"hidden"` // Deprecated: Deprecated in Mimir 2.12, remove in Mimir 2.14 (https://github.com/grafana/mimir/issues/6712)
	ResultsCacheConfig             `yaml:"results_cache"`
	CacheResults                   bool          `yaml:"cache_results"`
	MaxRetries                     int           `yaml:"max_retries" category:"advanced"`
	NotRunningTimeout              time.Duration `yaml:"not_running_timeout" category:"advanced"`
	ShardedQueries                 bool          `yaml:"parallelize_shardable_queries"`
	TargetSeriesPerShard           uint64        `yaml:"query_sharding_target_series_per_shard" category:"advanced"`
	ShardActiveSeriesQueries       bool          `yaml:"shard_active_series_queries" category:"experimental"`
	UseActiveSeriesDecoder         bool          `yaml:"use_active_series_decoder" category:"experimental"`

	// CacheKeyGenerator allows to inject a CacheKeyGenerator to use for generating cache keys.
	// If nil, the querymiddleware package uses a DefaultCacheKeyGenerator with SplitQueriesByInterval.
	CacheKeyGenerator CacheKeyGenerator `yaml:"-"`

	QueryResultResponseFormat string `yaml:"query_result_response_format"`
}

Config for query_range middleware chain.

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet.

func (*Config) Validate

func (cfg *Config) Validate() error

Validate validates the config.

type DefaultCacheKeyGenerator

type DefaultCacheKeyGenerator struct {
	// contains filtered or unexported fields
}

func NewDefaultCacheKeyGenerator

func NewDefaultCacheKeyGenerator(codec Codec, interval time.Duration) DefaultCacheKeyGenerator

func (DefaultCacheKeyGenerator) LabelValues

func (DefaultCacheKeyGenerator) LabelValuesCardinality

func (DefaultCacheKeyGenerator) LabelValuesCardinality(r *http.Request) (*GenericQueryCacheKey, error)

func (DefaultCacheKeyGenerator) QueryRequest

QueryRequest generates a cache key based on the userID, MetricsQueryRequest and interval.

type EstimatedSeriesCount

type EstimatedSeriesCount struct {
	EstimatedSeriesCount uint64
}

type Extent

type Extent struct {
	Start    int64      `protobuf:"varint,1,opt,name=start,proto3" json:"start"`
	End      int64      `protobuf:"varint,2,opt,name=end,proto3" json:"end"`
	TraceId  string     `protobuf:"bytes,4,opt,name=trace_id,json=traceId,proto3" json:"-"`
	Response *types.Any `protobuf:"bytes,5,opt,name=response,proto3" json:"response"`
	// Unix timestamp when the query with this response was executed.
	// If the response is combination of multiple queries over time, all of which had timestamp set, this is the timestamp of oldest query.
	// When merging extents and some of them have 0 query timestamp, we keep non-zero timestamp, if possible.
	QueryTimestampMs int64 `protobuf:"varint,6,opt,name=query_timestamp_ms,json=queryTimestampMs,proto3" json:"query_timestamp_ms,omitempty"`
}

func (*Extent) Descriptor

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

func (*Extent) Equal

func (this *Extent) Equal(that interface{}) bool

func (*Extent) GetEnd

func (m *Extent) GetEnd() int64

func (*Extent) GetQueryTimestampMs

func (m *Extent) GetQueryTimestampMs() int64

func (*Extent) GetResponse

func (m *Extent) GetResponse() *types.Any

func (*Extent) GetStart

func (m *Extent) GetStart() int64

func (*Extent) GetTraceId

func (m *Extent) GetTraceId() string

func (*Extent) GoString

func (this *Extent) GoString() string

func (*Extent) Marshal

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

func (*Extent) MarshalTo

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

func (*Extent) MarshalToSizedBuffer

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

func (*Extent) ProtoMessage

func (*Extent) ProtoMessage()

func (*Extent) Reset

func (m *Extent) Reset()

func (*Extent) Size

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

func (*Extent) String

func (this *Extent) String() string

func (*Extent) Unmarshal

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

func (*Extent) XXX_DiscardUnknown

func (m *Extent) XXX_DiscardUnknown()

func (*Extent) XXX_Marshal

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

func (*Extent) XXX_Merge

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

func (*Extent) XXX_Size

func (m *Extent) XXX_Size() int

func (*Extent) XXX_Unmarshal

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

type Extractor

type Extractor interface {
	// Extract extracts a subset of a response from the `start` and `end` timestamps in milliseconds in the `from` response.
	Extract(start, end int64, from Response) Response
	ResponseWithoutHeaders(resp Response) Response
}

Extractor is used by the cache to extract a subset of a response from a cache entry.

type GenericQueryCacheKey

type GenericQueryCacheKey struct {
	// CacheKey is a full non-hashed representation of the request, used to uniquely identify
	// a request in the cache.
	CacheKey string

	// CacheKeyPrefix is a cache key prefix to use for this request.
	CacheKeyPrefix string
}

type HandlerFunc

type HandlerFunc func(context.Context, MetricsQueryRequest) (Response, error)

HandlerFunc is like http.HandlerFunc, but for MetricsQueryHandler.

func (HandlerFunc) Do

Do implements MetricsQueryHandler.

type Hints

type Hints struct {
	// Total number of queries that are expected to be executed to serve the original request.
	TotalQueries int32
	// Estimated total number of series that a request might return.
	CardinalityEstimate *EstimatedSeriesCount
}

func (*Hints) GetCardinalityEstimate

func (h *Hints) GetCardinalityEstimate() *EstimatedSeriesCount

func (*Hints) GetEstimatedSeriesCount

func (h *Hints) GetEstimatedSeriesCount() uint64

func (*Hints) GetTotalQueries

func (h *Hints) GetTotalQueries() int32

type LabelsQueryRequest

type LabelsQueryRequest interface {
	// GetLabelName returns the label name param from a Label Values request `/api/v1/label/<label_name>/values`
	// or an empty string for a Label Names request `/api/v1/labels`
	GetLabelName() string
	// GetStart returns the start timestamp of the request in milliseconds
	GetStart() int64
	// GetStartOrDefault returns the start timestamp of the request in milliseconds,
	// or the Prometheus v1 API MinTime if no start timestamp was provided on the original request.
	GetStartOrDefault() int64
	// GetEnd returns the start timestamp of the request in milliseconds
	GetEnd() int64
	// GetEndOrDefault returns the end timestamp of the request in milliseconds,
	// or the Prometheus v1 API MaxTime if no end timestamp was provided on the original request.
	GetEndOrDefault() int64
	// GetLabelMatcherSets returns the label matchers a.k.a series selectors for Prometheus label query requests,
	// as retained in their original string format. This enables the request to be symmetrically decoded and encoded
	// to and from the http request format without needing to undo the Prometheus parser converting between formats
	// like `up{job="prometheus"}` and `{__name__="up, job="prometheus"}`, or other idiosyncrasies.
	GetLabelMatcherSets() []string
	// GetLimit returns the limit of the number of items in the response.
	GetLimit() uint64
	// AddSpanTags writes information about this request to an OpenTracing span
	AddSpanTags(opentracing.Span)
}

LabelsQueryRequest represents a label names or values query request that can be process by middlewares.

type Limits

type Limits interface {
	// MaxQueryLookback returns the max lookback period of queries.
	MaxQueryLookback(userID string) time.Duration

	// MaxTotalQueryLength returns the limit of the length (in time) of a query.
	MaxTotalQueryLength(userID string) time.Duration

	// MaxQueryParallelism returns the limit to the number of split queries the
	// frontend will process in parallel.
	MaxQueryParallelism(userID string) int

	// MaxQueryExpressionSizeBytes returns the limit of the max number of bytes long a raw
	// query may be. 0 means "unlimited".
	MaxQueryExpressionSizeBytes(userID string) int

	// MaxCacheFreshness returns the period after which results are cacheable,
	// to prevent caching of very recent results.
	MaxCacheFreshness(userID string) time.Duration

	// QueryShardingTotalShards returns the number of shards to use for a given tenant.
	QueryShardingTotalShards(userID string) int

	// QueryShardingMaxShardedQueries returns the max number of sharded queries that can
	// be run for a given received query. 0 to disable limit.
	QueryShardingMaxShardedQueries(userID string) int

	// QueryShardingMaxRegexpSizeBytes returns the limit to the max number of bytes allowed
	// for a regexp matcher in a shardable query. If a query contains a regexp matcher longer
	// than this limit, the query will not be sharded. 0 to disable limit.
	QueryShardingMaxRegexpSizeBytes(userID string) int

	// SplitInstantQueriesByInterval returns the time interval to split instant queries for a given tenant.
	SplitInstantQueriesByInterval(userID string) time.Duration

	// CompactorSplitAndMergeShards returns the number of shards to use when splitting blocks
	// This method is copied from compactor.ConfigProvider.
	CompactorSplitAndMergeShards(userID string) int

	// CompactorBlocksRetentionPeriod returns the retention period for a given user.
	CompactorBlocksRetentionPeriod(userID string) time.Duration

	// OutOfOrderTimeWindow returns the out-of-order time window for the user.
	OutOfOrderTimeWindow(userID string) time.Duration

	// CreationGracePeriod returns the time interval to control how far into the future
	// incoming samples are accepted compared to the wall clock.
	CreationGracePeriod(userID string) time.Duration

	// NativeHistogramsIngestionEnabled returns whether to ingest native histograms in the ingester
	NativeHistogramsIngestionEnabled(userID string) bool

	// ResultsCacheTTL returns TTL for cached results for query that doesn't fall into out of order window, or
	// if out of order ingestion is disabled.
	ResultsCacheTTL(userID string) time.Duration

	// ResultsCacheTTLForOutOfOrderTimeWindow returns TTL for cached results for query that falls into out-of-order ingestion window.
	ResultsCacheTTLForOutOfOrderTimeWindow(userID string) time.Duration

	// ResultsCacheTTLForCardinalityQuery returns TTL for cached results for cardinality queries.
	ResultsCacheTTLForCardinalityQuery(userID string) time.Duration

	// ResultsCacheTTLForLabelsQuery returns TTL for cached results for label names and values queries.
	ResultsCacheTTLForLabelsQuery(userID string) time.Duration

	// ResultsCacheForUnalignedQueryEnabled returns whether to cache results for queries that are not step-aligned
	ResultsCacheForUnalignedQueryEnabled(userID string) bool

	// BlockedQueries returns the blocked queries.
	BlockedQueries(userID string) []*validation.BlockedQuery

	// AlignQueriesWithStep returns if queries should be adjusted to be step-aligned
	AlignQueriesWithStep(userID string) bool

	// QueryIngestersWithin returns the maximum lookback beyond which queries are not sent to ingester.
	QueryIngestersWithin(userID string) time.Duration
}

Limits allows us to specify per-tenant runtime limits on the behavior of the query handling code.

type Merger

type Merger interface {
	// MergeResponse merges responses from multiple requests into a single Response
	MergeResponse(...Response) (Response, error)
}

Merger is used by middlewares making multiple requests to merge back all responses into a single one.

type MetricsQueryHandler

type MetricsQueryHandler interface {
	Do(context.Context, MetricsQueryRequest) (Response, error)
}

MetricsQueryHandler is like http.Handle, but specifically for Prometheus query and query_range calls.

type MetricsQueryMiddleware

type MetricsQueryMiddleware interface {
	Wrap(MetricsQueryHandler) MetricsQueryHandler
}

MetricsQueryMiddleware is a higher order MetricsQueryHandler.

func MergeMetricsQueryMiddlewares

func MergeMetricsQueryMiddlewares(middleware ...MetricsQueryMiddleware) MetricsQueryMiddleware

MergeMetricsQueryMiddlewares produces a middleware that applies multiple middleware in turn; ie Merge(f,g,h).Wrap(handler) == f.Wrap(g.Wrap(h.Wrap(handler)))

type MetricsQueryMiddlewareFunc

type MetricsQueryMiddlewareFunc func(MetricsQueryHandler) MetricsQueryHandler

MetricsQueryMiddlewareFunc is like http.HandlerFunc, but for MetricsQueryMiddleware.

func (MetricsQueryMiddlewareFunc) Wrap

Wrap implements MetricsQueryMiddleware.

type MetricsQueryRequest

type MetricsQueryRequest interface {
	// GetID returns the ID of the request used to correlate downstream requests and responses.
	GetID() int64
	// GetStart returns the start timestamp of the request in milliseconds.
	GetStart() int64
	// GetEnd returns the end timestamp of the request in milliseconds.
	GetEnd() int64
	// GetStep returns the step of the request in milliseconds.
	GetStep() int64
	// GetQuery returns the query of the request.
	GetQuery() string
	// GetOptions returns the options for the given request.
	GetOptions() Options
	// GetHints returns hints that could be optionally attached to the request to pass down the stack.
	// These hints can be used to optimize the query execution.
	GetHints() *Hints
	// WithID clones the current request with the provided ID.
	WithID(id int64) MetricsQueryRequest
	// WithStartEnd clone the current request with different start and end timestamp.
	WithStartEnd(startTime int64, endTime int64) MetricsQueryRequest
	// WithQuery clone the current request with a different query.
	WithQuery(string) MetricsQueryRequest
	// WithTotalQueriesHint adds the number of total queries to this request's Hints.
	WithTotalQueriesHint(int32) MetricsQueryRequest
	// WithEstimatedSeriesCountHint WithEstimatedCardinalityHint adds a cardinality estimate to this request's Hints.
	WithEstimatedSeriesCountHint(uint64) MetricsQueryRequest
	// AddSpanTags writes information about this request to an OpenTracing span
	AddSpanTags(opentracing.Span)
}

MetricsQueryRequest represents an instant or query range request that can be process by middlewares.

type Options

type Options struct {
	CacheDisabled        bool  `protobuf:"varint,1,opt,name=CacheDisabled,proto3" json:"CacheDisabled,omitempty"`
	ShardingDisabled     bool  `protobuf:"varint,2,opt,name=ShardingDisabled,proto3" json:"ShardingDisabled,omitempty"`
	TotalShards          int32 `protobuf:"varint,3,opt,name=TotalShards,proto3" json:"TotalShards,omitempty"`
	InstantSplitDisabled bool  `protobuf:"varint,4,opt,name=InstantSplitDisabled,proto3" json:"InstantSplitDisabled,omitempty"`
	// Instant split by time interval unit stored in nanoseconds (time.Duration unit in int64)
	InstantSplitInterval int64 `protobuf:"varint,5,opt,name=InstantSplitInterval,proto3" json:"InstantSplitInterval,omitempty"`
}

func (*Options) Descriptor

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

func (*Options) Equal

func (this *Options) Equal(that interface{}) bool

func (*Options) GetCacheDisabled

func (m *Options) GetCacheDisabled() bool

func (*Options) GetInstantSplitDisabled

func (m *Options) GetInstantSplitDisabled() bool

func (*Options) GetInstantSplitInterval

func (m *Options) GetInstantSplitInterval() int64

func (*Options) GetShardingDisabled

func (m *Options) GetShardingDisabled() bool

func (*Options) GetTotalShards

func (m *Options) GetTotalShards() int32

func (*Options) GoString

func (this *Options) GoString() string

func (*Options) Marshal

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

func (*Options) MarshalTo

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

func (*Options) MarshalToSizedBuffer

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

func (*Options) ProtoMessage

func (*Options) ProtoMessage()

func (*Options) Reset

func (m *Options) Reset()

func (*Options) Size

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

func (*Options) String

func (this *Options) String() string

func (*Options) Unmarshal

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

func (*Options) XXX_DiscardUnknown

func (m *Options) XXX_DiscardUnknown()

func (*Options) XXX_Marshal

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

func (*Options) XXX_Merge

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

func (*Options) XXX_Size

func (m *Options) XXX_Size() int

func (*Options) XXX_Unmarshal

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

type PrometheusData

type PrometheusData struct {
	ResultType string         `protobuf:"bytes,1,opt,name=ResultType,proto3" json:"resultType"`
	Result     []SampleStream `protobuf:"bytes,2,rep,name=Result,proto3" json:"result"`
}

func (*PrometheusData) Descriptor

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

func (*PrometheusData) Equal

func (this *PrometheusData) Equal(that interface{}) bool

func (*PrometheusData) GetResult

func (m *PrometheusData) GetResult() []SampleStream

func (*PrometheusData) GetResultType

func (m *PrometheusData) GetResultType() string

func (*PrometheusData) GoString

func (this *PrometheusData) GoString() string

func (*PrometheusData) Marshal

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

func (*PrometheusData) MarshalJSON

func (d *PrometheusData) MarshalJSON() ([]byte, error)

func (*PrometheusData) MarshalTo

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

func (*PrometheusData) MarshalToSizedBuffer

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

func (*PrometheusData) ProtoMessage

func (*PrometheusData) ProtoMessage()

func (*PrometheusData) Reset

func (m *PrometheusData) Reset()

func (*PrometheusData) Size

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

func (*PrometheusData) String

func (this *PrometheusData) String() string

func (*PrometheusData) Unmarshal

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

func (*PrometheusData) UnmarshalJSON

func (d *PrometheusData) UnmarshalJSON(b []byte) error

func (*PrometheusData) XXX_DiscardUnknown

func (m *PrometheusData) XXX_DiscardUnknown()

func (*PrometheusData) XXX_Marshal

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

func (*PrometheusData) XXX_Merge

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

func (*PrometheusData) XXX_Size

func (m *PrometheusData) XXX_Size() int

func (*PrometheusData) XXX_Unmarshal

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

type PrometheusInstantQueryRequest

type PrometheusInstantQueryRequest struct {
	Path    string
	Time    int64
	Query   string
	Options Options
	// ID of the request used to correlate downstream requests and responses.
	ID int64
	// Hints that could be optionally attached to the request to pass down the stack.
	// These hints can be used to optimize the query execution.
	Hints *Hints
}

func (*PrometheusInstantQueryRequest) AddSpanTags

func (r *PrometheusInstantQueryRequest) AddSpanTags(sp opentracing.Span)

AddSpanTags writes query information about the current `PrometheusInstantQueryRequest` to a span's tag ("attributes" in OpenTelemetry parlance).

func (*PrometheusInstantQueryRequest) GetEnd

func (*PrometheusInstantQueryRequest) GetHints

func (r *PrometheusInstantQueryRequest) GetHints() *Hints

func (*PrometheusInstantQueryRequest) GetID

func (*PrometheusInstantQueryRequest) GetOptions

func (r *PrometheusInstantQueryRequest) GetOptions() Options

func (*PrometheusInstantQueryRequest) GetPath

func (*PrometheusInstantQueryRequest) GetQuery

func (r *PrometheusInstantQueryRequest) GetQuery() string

func (*PrometheusInstantQueryRequest) GetStart

func (r *PrometheusInstantQueryRequest) GetStart() int64

func (*PrometheusInstantQueryRequest) GetStep

func (r *PrometheusInstantQueryRequest) GetStep() int64

func (*PrometheusInstantQueryRequest) GetTime

func (r *PrometheusInstantQueryRequest) GetTime() int64

func (*PrometheusInstantQueryRequest) WithEstimatedSeriesCountHint

func (r *PrometheusInstantQueryRequest) WithEstimatedSeriesCountHint(count uint64) MetricsQueryRequest

func (*PrometheusInstantQueryRequest) WithID

func (*PrometheusInstantQueryRequest) WithQuery

func (*PrometheusInstantQueryRequest) WithStartEnd

func (r *PrometheusInstantQueryRequest) WithStartEnd(startTime int64, _ int64) MetricsQueryRequest

func (*PrometheusInstantQueryRequest) WithTotalQueriesHint

func (r *PrometheusInstantQueryRequest) WithTotalQueriesHint(totalQueries int32) MetricsQueryRequest

type PrometheusLabelNamesQueryRequest

type PrometheusLabelNamesQueryRequest struct {
	Path  string
	Start int64
	End   int64
	// labelMatcherSets is a repeated field here in order to enable the representation
	// of labels queries which have not yet been split; the prometheus querier code
	// will eventually split requests like `?match[]=up&match[]=process_start_time_seconds{job="prometheus"}`
	// into separate queries, one for each matcher set
	LabelMatcherSets []string
	// ID of the request used to correlate downstream requests and responses.
	ID int64
	// Limit the number of label names returned. A value of 0 means no limit
	Limit uint64
}

func (*PrometheusLabelNamesQueryRequest) AddSpanTags

func (r *PrometheusLabelNamesQueryRequest) AddSpanTags(sp opentracing.Span)

AddSpanTags writes query information about the current `PrometheusLabelNamesQueryRequest` to a span's tag ("attributes" in OpenTelemetry parlance).

func (*PrometheusLabelNamesQueryRequest) GetEnd

func (*PrometheusLabelNamesQueryRequest) GetEndOrDefault

func (r *PrometheusLabelNamesQueryRequest) GetEndOrDefault() int64

func (*PrometheusLabelNamesQueryRequest) GetID

func (*PrometheusLabelNamesQueryRequest) GetLabelMatcherSets

func (r *PrometheusLabelNamesQueryRequest) GetLabelMatcherSets() []string

func (*PrometheusLabelNamesQueryRequest) GetLabelName

func (r *PrometheusLabelNamesQueryRequest) GetLabelName() string

func (*PrometheusLabelNamesQueryRequest) GetLimit

func (*PrometheusLabelNamesQueryRequest) GetPath

func (*PrometheusLabelNamesQueryRequest) GetStart

func (*PrometheusLabelNamesQueryRequest) GetStartOrDefault

func (r *PrometheusLabelNamesQueryRequest) GetStartOrDefault() int64

type PrometheusLabelValuesQueryRequest

type PrometheusLabelValuesQueryRequest struct {
	Path      string
	LabelName string
	Start     int64
	End       int64
	// labelMatcherSets is a repeated field here in order to enable the representation
	// of labels queries which have not yet been split; the prometheus querier code
	// will eventually split requests like `?match[]=up&match[]=process_start_time_seconds{job="prometheus"}`
	// into separate queries, one for each matcher set
	LabelMatcherSets []string
	// ID of the request used to correlate downstream requests and responses.
	ID int64
	// Limit the number of label values returned. A value of 0 means no limit.
	Limit uint64
}

func (*PrometheusLabelValuesQueryRequest) AddSpanTags

func (r *PrometheusLabelValuesQueryRequest) AddSpanTags(sp opentracing.Span)

AddSpanTags writes query information about the current `PrometheusLabelNamesQueryRequest` to a span's tag ("attributes" in OpenTelemetry parlance).

func (*PrometheusLabelValuesQueryRequest) GetEnd

func (*PrometheusLabelValuesQueryRequest) GetEndOrDefault

func (r *PrometheusLabelValuesQueryRequest) GetEndOrDefault() int64

func (*PrometheusLabelValuesQueryRequest) GetID

func (*PrometheusLabelValuesQueryRequest) GetLabelMatcherSets

func (r *PrometheusLabelValuesQueryRequest) GetLabelMatcherSets() []string

func (*PrometheusLabelValuesQueryRequest) GetLabelName

func (r *PrometheusLabelValuesQueryRequest) GetLabelName() string

func (*PrometheusLabelValuesQueryRequest) GetLimit

func (*PrometheusLabelValuesQueryRequest) GetStart

func (*PrometheusLabelValuesQueryRequest) GetStartOrDefault

func (r *PrometheusLabelValuesQueryRequest) GetStartOrDefault() int64

type PrometheusRangeQueryRequest

type PrometheusRangeQueryRequest struct {
	Path    string
	Start   int64
	End     int64
	Step    int64
	Timeout time.Duration
	Query   string
	Options Options
	// ID of the request used to correlate downstream requests and responses.
	ID int64
	// Hints that could be optionally attached to the request to pass down the stack.
	// These hints can be used to optimize the query execution.
	Hints *Hints
}

func (*PrometheusRangeQueryRequest) AddSpanTags

func (r *PrometheusRangeQueryRequest) AddSpanTags(sp opentracing.Span)

AddSpanTags writes the current `PrometheusRangeQueryRequest` parameters to the specified span tags ("attributes" in OpenTelemetry parlance).

func (*PrometheusRangeQueryRequest) GetEnd

func (r *PrometheusRangeQueryRequest) GetEnd() int64

func (*PrometheusRangeQueryRequest) GetHints

func (r *PrometheusRangeQueryRequest) GetHints() *Hints

func (*PrometheusRangeQueryRequest) GetID

func (*PrometheusRangeQueryRequest) GetOptions

func (r *PrometheusRangeQueryRequest) GetOptions() Options

func (*PrometheusRangeQueryRequest) GetPath

func (r *PrometheusRangeQueryRequest) GetPath() string

func (*PrometheusRangeQueryRequest) GetQuery

func (r *PrometheusRangeQueryRequest) GetQuery() string

func (*PrometheusRangeQueryRequest) GetStart

func (r *PrometheusRangeQueryRequest) GetStart() int64

func (*PrometheusRangeQueryRequest) GetStep

func (r *PrometheusRangeQueryRequest) GetStep() int64

func (*PrometheusRangeQueryRequest) GetTimeout

func (r *PrometheusRangeQueryRequest) GetTimeout() time.Duration

func (*PrometheusRangeQueryRequest) WithEstimatedSeriesCountHint

func (r *PrometheusRangeQueryRequest) WithEstimatedSeriesCountHint(count uint64) MetricsQueryRequest

WithEstimatedSeriesCountHint clones the current `PrometheusRangeQueryRequest` with an added Hint value for EstimatedCardinality.

func (*PrometheusRangeQueryRequest) WithID

WithID clones the current `PrometheusRangeQueryRequest` with the provided ID.

func (*PrometheusRangeQueryRequest) WithQuery

WithQuery clones the current `PrometheusRangeQueryRequest` with a new query.

func (*PrometheusRangeQueryRequest) WithStartEnd

func (r *PrometheusRangeQueryRequest) WithStartEnd(start int64, end int64) MetricsQueryRequest

WithStartEnd clones the current `PrometheusRangeQueryRequest` with a new `start` and `end` timestamp.

func (*PrometheusRangeQueryRequest) WithTotalQueriesHint

func (r *PrometheusRangeQueryRequest) WithTotalQueriesHint(totalQueries int32) MetricsQueryRequest

WithTotalQueriesHint clones the current `PrometheusRangeQueryRequest` with an added Hint value for TotalQueries.

type PrometheusResponse

type PrometheusResponse struct {
	Status    string                      `protobuf:"bytes,1,opt,name=Status,proto3" json:"status"`
	Data      *PrometheusData             `protobuf:"bytes,2,opt,name=Data,proto3" json:"data,omitempty"`
	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   []*PrometheusResponseHeader `protobuf:"bytes,5,rep,name=Headers,proto3" json:"-"`
	Warnings  []string                    `protobuf:"bytes,6,rep,name=Warnings,proto3" json:"warnings,omitempty"`
}

func (*PrometheusResponse) Descriptor

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

func (*PrometheusResponse) Equal

func (this *PrometheusResponse) Equal(that interface{}) bool

func (*PrometheusResponse) GetData

func (m *PrometheusResponse) GetData() *PrometheusData

func (*PrometheusResponse) GetError

func (m *PrometheusResponse) GetError() string

func (*PrometheusResponse) GetErrorType

func (m *PrometheusResponse) GetErrorType() string

func (*PrometheusResponse) GetHeaders

func (m *PrometheusResponse) GetHeaders() []*PrometheusResponseHeader

func (*PrometheusResponse) GetStatus

func (m *PrometheusResponse) GetStatus() string

func (*PrometheusResponse) GetWarnings

func (m *PrometheusResponse) GetWarnings() []string

func (*PrometheusResponse) GoString

func (this *PrometheusResponse) GoString() string

func (*PrometheusResponse) Marshal

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

func (*PrometheusResponse) MarshalTo

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

func (*PrometheusResponse) MarshalToSizedBuffer

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

func (*PrometheusResponse) ProtoMessage

func (*PrometheusResponse) ProtoMessage()

func (*PrometheusResponse) Reset

func (m *PrometheusResponse) Reset()

func (*PrometheusResponse) Size

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

func (*PrometheusResponse) String

func (this *PrometheusResponse) String() string

func (*PrometheusResponse) Unmarshal

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

func (*PrometheusResponse) XXX_DiscardUnknown

func (m *PrometheusResponse) XXX_DiscardUnknown()

func (*PrometheusResponse) XXX_Marshal

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

func (*PrometheusResponse) XXX_Merge

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

func (*PrometheusResponse) XXX_Size

func (m *PrometheusResponse) XXX_Size() int

func (*PrometheusResponse) XXX_Unmarshal

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

type PrometheusResponseExtractor

type PrometheusResponseExtractor struct{}

PrometheusResponseExtractor helps extracting specific info from Query Response.

func (PrometheusResponseExtractor) Extract

func (PrometheusResponseExtractor) Extract(start, end int64, from Response) Response

Extract extracts response for specific a range from a response.

func (PrometheusResponseExtractor) ResponseWithoutHeaders

func (PrometheusResponseExtractor) ResponseWithoutHeaders(resp Response) Response

ResponseWithoutHeaders is useful in caching data without headers since we anyways do not need headers for sending back the response so this saves some space by reducing size of the objects.

type PrometheusResponseHeader

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

func (*PrometheusResponseHeader) Descriptor

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

func (*PrometheusResponseHeader) Equal

func (this *PrometheusResponseHeader) Equal(that interface{}) bool

func (*PrometheusResponseHeader) GetName

func (m *PrometheusResponseHeader) GetName() string

func (*PrometheusResponseHeader) GetValues

func (m *PrometheusResponseHeader) GetValues() []string

func (*PrometheusResponseHeader) GoString

func (this *PrometheusResponseHeader) GoString() string

func (*PrometheusResponseHeader) Marshal

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

func (*PrometheusResponseHeader) MarshalTo

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

func (*PrometheusResponseHeader) MarshalToSizedBuffer

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

func (*PrometheusResponseHeader) ProtoMessage

func (*PrometheusResponseHeader) ProtoMessage()

func (*PrometheusResponseHeader) Reset

func (m *PrometheusResponseHeader) Reset()

func (*PrometheusResponseHeader) Size

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

func (*PrometheusResponseHeader) String

func (this *PrometheusResponseHeader) String() string

func (*PrometheusResponseHeader) Unmarshal

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

func (*PrometheusResponseHeader) XXX_DiscardUnknown

func (m *PrometheusResponseHeader) XXX_DiscardUnknown()

func (*PrometheusResponseHeader) XXX_Marshal

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

func (*PrometheusResponseHeader) XXX_Merge

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

func (*PrometheusResponseHeader) XXX_Size

func (m *PrometheusResponseHeader) XXX_Size() int

func (*PrometheusResponseHeader) XXX_Unmarshal

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

type QueryDetails

type QueryDetails struct {
	QuerierStats *stats.Stats

	// Start and End are the parsed start and end times of the unmodified user request.
	Start, End time.Time
	// MinT and MaxT are the earliest and latest points in time which the query might try to use.
	// For example, they account for range selectors and @ modifiers.
	// MinT and MaxT may be zero-valued if the query doesn't process samples.
	MinT, MaxT time.Time
	Step       time.Duration

	ResultsCacheMissBytes int
	ResultsCacheHitBytes  int
}

func ContextWithEmptyDetails

func ContextWithEmptyDetails(ctx context.Context) (*QueryDetails, context.Context)

ContextWithEmptyDetails returns a context with empty QueryDetails. The returned context also has querier stats.Stats injected. The stats pointer in the context and the stats pointer in the QueryDetails are the same.

func QueryDetailsFromContext

func QueryDetailsFromContext(ctx context.Context) *QueryDetails

QueryDetailsFromContext gets the QueryDetails out of the Context. Returns nil if stats have not been initialised in the context.

type QueryStatistics

type QueryStatistics struct {
	EstimatedSeriesCount uint64 `protobuf:"varint,1,opt,name=EstimatedSeriesCount,proto3" json:"EstimatedSeriesCount,omitempty"`
}

func (*QueryStatistics) Descriptor

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

func (*QueryStatistics) Equal

func (this *QueryStatistics) Equal(that interface{}) bool

func (*QueryStatistics) GetEstimatedSeriesCount

func (m *QueryStatistics) GetEstimatedSeriesCount() uint64

func (*QueryStatistics) GoString

func (this *QueryStatistics) GoString() string

func (*QueryStatistics) Marshal

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

func (*QueryStatistics) MarshalTo

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

func (*QueryStatistics) MarshalToSizedBuffer

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

func (*QueryStatistics) ProtoMessage

func (*QueryStatistics) ProtoMessage()

func (*QueryStatistics) Reset

func (m *QueryStatistics) Reset()

func (*QueryStatistics) Size

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

func (*QueryStatistics) String

func (this *QueryStatistics) String() string

func (*QueryStatistics) Unmarshal

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

func (*QueryStatistics) XXX_DiscardUnknown

func (m *QueryStatistics) XXX_DiscardUnknown()

func (*QueryStatistics) XXX_Marshal

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

func (*QueryStatistics) XXX_Merge

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

func (*QueryStatistics) XXX_Size

func (m *QueryStatistics) XXX_Size() int

func (*QueryStatistics) XXX_Unmarshal

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

type Response

type Response interface {
	proto.Message
	// GetHeaders returns the HTTP headers in the response.
	GetHeaders() []*PrometheusResponseHeader
}

Response represents a query range response.

type ResultsCacheConfig

type ResultsCacheConfig struct {
	cache.BackendConfig `yaml:",inline"`
	Compression         cache.CompressionConfig `yaml:",inline"`
}

ResultsCacheConfig is the config for the results cache.

func (*ResultsCacheConfig) RegisterFlags

func (cfg *ResultsCacheConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

func (*ResultsCacheConfig) Validate

func (cfg *ResultsCacheConfig) Validate() error

type RoundTripFunc

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

RoundTripFunc is to http.RoundTripper what http.HandlerFunc is to http.Handler.

func (RoundTripFunc) RoundTrip

func (f RoundTripFunc) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type SampleStream

type SampleStream struct {
	Labels     []github_com_grafana_mimir_pkg_mimirpb.LabelAdapter `protobuf:"bytes,1,rep,name=labels,proto3,customtype=github.com/grafana/mimir/pkg/mimirpb.LabelAdapter" json:"metric"`
	Samples    []mimirpb.Sample                                    `protobuf:"bytes,2,rep,name=samples,proto3" json:"values"`
	Histograms []mimirpb.FloatHistogramPair                        `protobuf:"bytes,3,rep,name=histograms,proto3" json:"histograms"`
}

func (*SampleStream) Descriptor

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

func (*SampleStream) Equal

func (this *SampleStream) Equal(that interface{}) bool

func (*SampleStream) GetHistograms

func (m *SampleStream) GetHistograms() []mimirpb.FloatHistogramPair

func (*SampleStream) GetSamples

func (m *SampleStream) GetSamples() []mimirpb.Sample

func (*SampleStream) GoString

func (this *SampleStream) GoString() string

func (*SampleStream) Marshal

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

func (*SampleStream) MarshalJSON

func (s *SampleStream) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*SampleStream) MarshalTo

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

func (*SampleStream) MarshalToSizedBuffer

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

func (*SampleStream) ProtoMessage

func (*SampleStream) ProtoMessage()

func (*SampleStream) Reset

func (m *SampleStream) Reset()

func (*SampleStream) Size

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

func (*SampleStream) String

func (this *SampleStream) String() string

func (*SampleStream) Unmarshal

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

func (*SampleStream) UnmarshalJSON

func (s *SampleStream) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*SampleStream) XXX_DiscardUnknown

func (m *SampleStream) XXX_DiscardUnknown()

func (*SampleStream) XXX_Marshal

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

func (*SampleStream) XXX_Merge

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

func (*SampleStream) XXX_Size

func (m *SampleStream) XXX_Size() int

func (*SampleStream) XXX_Unmarshal

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

type Tripperware

type Tripperware func(http.RoundTripper) http.RoundTripper

Tripperware is a signature for all http client-side middleware.

func MergeTripperwares

func MergeTripperwares(tripperware ...Tripperware) Tripperware

MergeTripperwares produces a tripperware that applies multiple tripperware in turn; ie Merge(f,g,h).Wrap(tripper) == f(g(h(tripper)))

func NewTripperware

func NewTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	codec Codec,
	cacheExtractor Extractor,
	engineOpts promql.EngineOpts,
	engineExperimentalFunctionsEnabled bool,
	registerer prometheus.Registerer,
) (Tripperware, error)

NewTripperware returns a Tripperware configured with middlewares to limit, align, split, retry and cache requests.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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