Documentation ¶
Index ¶
- Constants
- Variables
- func NewRoundTripper(next http.RoundTripper, codec Codec, headers []string, ...) http.RoundTripper
- func NewSeriesSet(results []SampleStream) storage.SeriesSet
- func PrometheusResponseQueryableSamplesStatsPerStepJsoniterDecode(ptr unsafe.Pointer, iter *jsoniter.Iterator)
- func PrometheusResponseQueryableSamplesStatsPerStepJsoniterEncode(ptr unsafe.Pointer, stream *jsoniter.Stream)
- type Buffer
- type CacheGenNumberLoader
- type CacheSplitter
- type CachedResponse
- func (*CachedResponse) Descriptor() ([]byte, []int)
- func (this *CachedResponse) Equal(that interface{}) bool
- func (m *CachedResponse) GetExtents() []Extent
- func (m *CachedResponse) GetKey() string
- func (this *CachedResponse) GoString() string
- func (m *CachedResponse) Marshal() (dAtA []byte, err error)
- func (m *CachedResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *CachedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CachedResponse) ProtoMessage()
- func (m *CachedResponse) Reset()
- func (m *CachedResponse) Size() (n int)
- func (this *CachedResponse) String() string
- func (m *CachedResponse) Unmarshal(dAtA []byte) error
- func (m *CachedResponse) XXX_DiscardUnknown()
- func (m *CachedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CachedResponse) XXX_Merge(src proto.Message)
- func (m *CachedResponse) XXX_Size() int
- func (m *CachedResponse) XXX_Unmarshal(b []byte) error
- type CachingOptions
- func (*CachingOptions) Descriptor() ([]byte, []int)
- func (this *CachingOptions) Equal(that interface{}) bool
- func (m *CachingOptions) GetDisabled() bool
- func (this *CachingOptions) GoString() string
- func (m *CachingOptions) Marshal() (dAtA []byte, err error)
- func (m *CachingOptions) MarshalTo(dAtA []byte) (int, error)
- func (m *CachingOptions) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CachingOptions) ProtoMessage()
- func (m *CachingOptions) Reset()
- func (m *CachingOptions) Size() (n int)
- func (this *CachingOptions) String() string
- func (m *CachingOptions) Unmarshal(dAtA []byte) error
- func (m *CachingOptions) XXX_DiscardUnknown()
- func (m *CachingOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CachingOptions) XXX_Merge(src proto.Message)
- func (m *CachingOptions) XXX_Size() int
- func (m *CachingOptions) XXX_Unmarshal(b []byte) error
- type Codec
- type Config
- type Extent
- func (*Extent) Descriptor() ([]byte, []int)
- func (this *Extent) Equal(that interface{}) bool
- func (m *Extent) GetEnd() int64
- func (m *Extent) GetResponse() *types.Any
- func (m *Extent) GetStart() int64
- func (m *Extent) GetTraceId() string
- func (this *Extent) GoString() string
- func (m *Extent) Marshal() (dAtA []byte, err error)
- func (m *Extent) MarshalTo(dAtA []byte) (int, error)
- func (m *Extent) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Extent) ProtoMessage()
- func (m *Extent) Reset()
- func (m *Extent) Size() (n int)
- func (this *Extent) String() string
- func (m *Extent) Unmarshal(dAtA []byte) error
- func (m *Extent) XXX_DiscardUnknown()
- func (m *Extent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Extent) XXX_Merge(src proto.Message)
- func (m *Extent) XXX_Size() int
- func (m *Extent) XXX_Unmarshal(b []byte) error
- type Extractor
- type Handler
- type HandlerFunc
- type InstrumentMiddlewareMetrics
- type IntervalFn
- type Limits
- type Merger
- type Middleware
- func InstrumentMiddleware(name string, metrics *InstrumentMiddlewareMetrics) Middleware
- func MergeMiddlewares(middleware ...Middleware) Middleware
- func NewLimitsMiddleware(l Limits) Middleware
- func NewQueryShardMiddleware(logger log.Logger, engine *promql.Engine, confs ShardingConfigs, codec Codec, ...) Middleware
- func NewResultsCacheMiddleware(logger log.Logger, cfg ResultsCacheConfig, splitter CacheSplitter, ...) (Middleware, cache.Cache, error)
- func NewRetryMiddleware(log log.Logger, maxRetries int, metrics *RetryMiddlewareMetrics) Middleware
- func SplitByIntervalMiddleware(interval IntervalFn, limits Limits, merger Merger, ...) Middleware
- type MiddlewareFunc
- type MockShardedQueryable
- func (q *MockShardedQueryable) Close() error
- func (q *MockShardedQueryable) LabelNames(matchers ...*labels.Matcher) ([]string, storage.Warnings, error)
- func (q *MockShardedQueryable) LabelValues(name string, matchers ...*labels.Matcher) ([]string, storage.Warnings, error)
- func (q *MockShardedQueryable) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error)
- func (q *MockShardedQueryable) Select(_ bool, _ *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet
- type NoopCollector
- type PrometheusData
- func (*PrometheusData) Descriptor() ([]byte, []int)
- func (this *PrometheusData) Equal(that interface{}) bool
- func (m *PrometheusData) GetResult() []SampleStream
- func (m *PrometheusData) GetResultType() string
- func (m *PrometheusData) GetStats() *PrometheusResponseStats
- func (this *PrometheusData) GoString() string
- func (m *PrometheusData) Marshal() (dAtA []byte, err error)
- func (m *PrometheusData) MarshalTo(dAtA []byte) (int, error)
- func (m *PrometheusData) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrometheusData) ProtoMessage()
- func (m *PrometheusData) Reset()
- func (m *PrometheusData) Size() (n int)
- func (this *PrometheusData) String() string
- func (m *PrometheusData) Unmarshal(dAtA []byte) error
- func (m *PrometheusData) XXX_DiscardUnknown()
- func (m *PrometheusData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrometheusData) XXX_Merge(src proto.Message)
- func (m *PrometheusData) XXX_Size() int
- func (m *PrometheusData) XXX_Unmarshal(b []byte) error
- type PrometheusRequest
- func (*PrometheusRequest) Descriptor() ([]byte, []int)
- func (this *PrometheusRequest) Equal(that interface{}) bool
- func (m *PrometheusRequest) GetCachingOptions() CachingOptions
- func (m *PrometheusRequest) GetEnd() int64
- func (m *PrometheusRequest) GetHeaders() []*PrometheusRequestHeader
- func (m *PrometheusRequest) GetPath() string
- func (m *PrometheusRequest) GetQuery() string
- func (m *PrometheusRequest) GetStart() int64
- func (m *PrometheusRequest) GetStats() string
- func (m *PrometheusRequest) GetStep() int64
- func (m *PrometheusRequest) GetTimeout() time.Duration
- func (this *PrometheusRequest) GoString() string
- func (q *PrometheusRequest) LogToSpan(sp opentracing.Span)
- func (m *PrometheusRequest) Marshal() (dAtA []byte, err error)
- func (m *PrometheusRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *PrometheusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrometheusRequest) ProtoMessage()
- func (m *PrometheusRequest) Reset()
- func (m *PrometheusRequest) Size() (n int)
- func (this *PrometheusRequest) String() string
- func (m *PrometheusRequest) Unmarshal(dAtA []byte) error
- func (q *PrometheusRequest) WithQuery(query string) Request
- func (q *PrometheusRequest) WithStartEnd(start int64, end int64) Request
- func (q *PrometheusRequest) WithStats(stats string) Request
- func (m *PrometheusRequest) XXX_DiscardUnknown()
- func (m *PrometheusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrometheusRequest) XXX_Merge(src proto.Message)
- func (m *PrometheusRequest) XXX_Size() int
- func (m *PrometheusRequest) XXX_Unmarshal(b []byte) error
- type PrometheusRequestHeader
- func (*PrometheusRequestHeader) Descriptor() ([]byte, []int)
- func (this *PrometheusRequestHeader) Equal(that interface{}) bool
- func (m *PrometheusRequestHeader) GetName() string
- func (m *PrometheusRequestHeader) GetValues() []string
- func (this *PrometheusRequestHeader) GoString() string
- func (m *PrometheusRequestHeader) Marshal() (dAtA []byte, err error)
- func (m *PrometheusRequestHeader) MarshalTo(dAtA []byte) (int, error)
- func (m *PrometheusRequestHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrometheusRequestHeader) ProtoMessage()
- func (m *PrometheusRequestHeader) Reset()
- func (m *PrometheusRequestHeader) Size() (n int)
- func (this *PrometheusRequestHeader) String() string
- func (m *PrometheusRequestHeader) Unmarshal(dAtA []byte) error
- func (m *PrometheusRequestHeader) XXX_DiscardUnknown()
- func (m *PrometheusRequestHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrometheusRequestHeader) XXX_Merge(src proto.Message)
- func (m *PrometheusRequestHeader) XXX_Size() int
- func (m *PrometheusRequestHeader) XXX_Unmarshal(b []byte) error
- type PrometheusResponse
- func (*PrometheusResponse) Descriptor() ([]byte, []int)
- func (this *PrometheusResponse) Equal(that interface{}) bool
- func (m *PrometheusResponse) GetData() PrometheusData
- func (m *PrometheusResponse) GetError() string
- func (m *PrometheusResponse) GetErrorType() string
- func (m *PrometheusResponse) GetHeaders() []*PrometheusResponseHeader
- func (m *PrometheusResponse) GetStatus() string
- func (this *PrometheusResponse) GoString() string
- func (m *PrometheusResponse) Marshal() (dAtA []byte, err error)
- func (m *PrometheusResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *PrometheusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrometheusResponse) ProtoMessage()
- func (m *PrometheusResponse) Reset()
- func (m *PrometheusResponse) Size() (n int)
- func (this *PrometheusResponse) String() string
- func (m *PrometheusResponse) Unmarshal(dAtA []byte) error
- func (m *PrometheusResponse) XXX_DiscardUnknown()
- func (m *PrometheusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrometheusResponse) XXX_Merge(src proto.Message)
- func (m *PrometheusResponse) XXX_Size() int
- func (m *PrometheusResponse) XXX_Unmarshal(b []byte) error
- type PrometheusResponseExtractor
- type PrometheusResponseHeader
- func (*PrometheusResponseHeader) Descriptor() ([]byte, []int)
- func (this *PrometheusResponseHeader) Equal(that interface{}) bool
- func (m *PrometheusResponseHeader) GetName() string
- func (m *PrometheusResponseHeader) GetValues() []string
- func (this *PrometheusResponseHeader) GoString() string
- func (m *PrometheusResponseHeader) Marshal() (dAtA []byte, err error)
- func (m *PrometheusResponseHeader) MarshalTo(dAtA []byte) (int, error)
- func (m *PrometheusResponseHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrometheusResponseHeader) ProtoMessage()
- func (m *PrometheusResponseHeader) Reset()
- func (m *PrometheusResponseHeader) Size() (n int)
- func (this *PrometheusResponseHeader) String() string
- func (m *PrometheusResponseHeader) Unmarshal(dAtA []byte) error
- func (m *PrometheusResponseHeader) XXX_DiscardUnknown()
- func (m *PrometheusResponseHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrometheusResponseHeader) XXX_Merge(src proto.Message)
- func (m *PrometheusResponseHeader) XXX_Size() int
- func (m *PrometheusResponseHeader) XXX_Unmarshal(b []byte) error
- type PrometheusResponseQueryableSamplesStatsPerStep
- func (*PrometheusResponseQueryableSamplesStatsPerStep) Descriptor() ([]byte, []int)
- func (this *PrometheusResponseQueryableSamplesStatsPerStep) Equal(that interface{}) bool
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) GetTimestampMs() int64
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) GetValue() int64
- func (this *PrometheusResponseQueryableSamplesStatsPerStep) GoString() string
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) Marshal() (dAtA []byte, err error)
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) MarshalTo(dAtA []byte) (int, error)
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrometheusResponseQueryableSamplesStatsPerStep) ProtoMessage()
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) Reset()
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) Size() (n int)
- func (this *PrometheusResponseQueryableSamplesStatsPerStep) String() string
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) Unmarshal(dAtA []byte) error
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_DiscardUnknown()
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_Merge(src proto.Message)
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_Size() int
- func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_Unmarshal(b []byte) error
- type PrometheusResponseSamplesStats
- func (*PrometheusResponseSamplesStats) Descriptor() ([]byte, []int)
- func (this *PrometheusResponseSamplesStats) Equal(that interface{}) bool
- func (m *PrometheusResponseSamplesStats) GetTotalQueryableSamples() int64
- func (m *PrometheusResponseSamplesStats) GetTotalQueryableSamplesPerStep() []*PrometheusResponseQueryableSamplesStatsPerStep
- func (this *PrometheusResponseSamplesStats) GoString() string
- func (m *PrometheusResponseSamplesStats) Marshal() (dAtA []byte, err error)
- func (m *PrometheusResponseSamplesStats) MarshalTo(dAtA []byte) (int, error)
- func (m *PrometheusResponseSamplesStats) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrometheusResponseSamplesStats) ProtoMessage()
- func (m *PrometheusResponseSamplesStats) Reset()
- func (m *PrometheusResponseSamplesStats) Size() (n int)
- func (this *PrometheusResponseSamplesStats) String() string
- func (m *PrometheusResponseSamplesStats) Unmarshal(dAtA []byte) error
- func (m *PrometheusResponseSamplesStats) XXX_DiscardUnknown()
- func (m *PrometheusResponseSamplesStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrometheusResponseSamplesStats) XXX_Merge(src proto.Message)
- func (m *PrometheusResponseSamplesStats) XXX_Size() int
- func (m *PrometheusResponseSamplesStats) XXX_Unmarshal(b []byte) error
- type PrometheusResponseStats
- func (*PrometheusResponseStats) Descriptor() ([]byte, []int)
- func (this *PrometheusResponseStats) Equal(that interface{}) bool
- func (m *PrometheusResponseStats) GetSamples() *PrometheusResponseSamplesStats
- func (this *PrometheusResponseStats) GoString() string
- func (m *PrometheusResponseStats) Marshal() (dAtA []byte, err error)
- func (m *PrometheusResponseStats) MarshalTo(dAtA []byte) (int, error)
- func (m *PrometheusResponseStats) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrometheusResponseStats) ProtoMessage()
- func (m *PrometheusResponseStats) Reset()
- func (m *PrometheusResponseStats) Size() (n int)
- func (this *PrometheusResponseStats) String() string
- func (m *PrometheusResponseStats) Unmarshal(dAtA []byte) error
- func (m *PrometheusResponseStats) XXX_DiscardUnknown()
- func (m *PrometheusResponseStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrometheusResponseStats) XXX_Merge(src proto.Message)
- func (m *PrometheusResponseStats) XXX_Size() int
- func (m *PrometheusResponseStats) XXX_Unmarshal(b []byte) error
- type Request
- type RequestResponse
- type Response
- type ResultsCacheConfig
- type RetryMiddlewareMetrics
- type RoundTripFunc
- type SampleStream
- func (*SampleStream) Descriptor() ([]byte, []int)
- func (this *SampleStream) Equal(that interface{}) bool
- func (m *SampleStream) GetSamples() []cortexpb.Sample
- func (this *SampleStream) GoString() string
- func (m *SampleStream) Marshal() (dAtA []byte, err error)
- func (s *SampleStream) MarshalJSON() ([]byte, error)
- func (m *SampleStream) MarshalTo(dAtA []byte) (int, error)
- func (m *SampleStream) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SampleStream) ProtoMessage()
- func (m *SampleStream) Reset()
- func (m *SampleStream) Size() (n int)
- func (this *SampleStream) String() string
- func (m *SampleStream) Unmarshal(dAtA []byte) error
- func (s *SampleStream) UnmarshalJSON(data []byte) error
- func (m *SampleStream) XXX_DiscardUnknown()
- func (m *SampleStream) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SampleStream) XXX_Merge(src proto.Message)
- func (m *SampleStream) XXX_Size() int
- func (m *SampleStream) XXX_Unmarshal(b []byte) error
- type ShardLabelSeries
- type ShardedQuerier
- func (q *ShardedQuerier) Close() error
- func (q *ShardedQuerier) LabelNames(matchers ...*labels.Matcher) ([]string, storage.Warnings, error)
- func (q *ShardedQuerier) LabelValues(name string, matchers ...*labels.Matcher) ([]string, storage.Warnings, error)
- func (q *ShardedQuerier) Select(_ bool, _ *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet
- type ShardedQueryable
- type ShardingConfigs
- type ShouldCacheFn
- type Tripperware
Constants ¶
const StatusSuccess = "success"
StatusSuccess Prometheus success result.
Variables ¶
var ( ErrInvalidLengthQueryrange = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowQueryrange = fmt.Errorf("proto: integer overflow") )
var ( // PassthroughMiddleware is a noop middleware PassthroughMiddleware = MiddlewareFunc(func(next Handler) Handler { return next }) )
var (
// ResultsCacheGenNumberHeaderName holds name of the header we want to set in http response
ResultsCacheGenNumberHeaderName = "Results-Cache-Gen-Number"
)
var StepAlignMiddleware = MiddlewareFunc(func(next Handler) Handler {
return stepAlign{
next: next,
}
})
StepAlignMiddleware aligns the start and end of request to the step to improved the cacheability of the query results.
Functions ¶
func NewRoundTripper ¶
func NewRoundTripper(next http.RoundTripper, codec Codec, headers []string, middlewares ...Middleware) http.RoundTripper
NewRoundTripper merges a set of middlewares into an handler, then inject it into the `next` roundtripper using the codec to translate requests and responses.
func NewSeriesSet ¶ added in v0.7.0
func NewSeriesSet(results []SampleStream) storage.SeriesSet
NewSeriesSet returns an in memory storage.SeriesSet from a []SampleStream As NewSeriesSet uses NewConcreteSeriesSet to implement SeriesSet, result will be sorted by label names.
func PrometheusResponseQueryableSamplesStatsPerStepJsoniterDecode ¶ added in v1.13.0
Types ¶
type Buffer ¶ added in v1.11.0
type Buffer interface {
Bytes() []byte
}
Buffer can be used to read a response body. This allows to avoid reading the body multiple times from the `http.Response.Body`.
type CacheGenNumberLoader ¶ added in v1.1.0
type CacheSplitter ¶ added in v0.7.0
CacheSplitter generates cache keys. This is a useful interface for downstream consumers who wish to implement their own strategies.
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) MarshalToSizedBuffer ¶ added in v0.7.0
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 CachingOptions ¶ added in v1.4.0
type CachingOptions struct {
Disabled bool `protobuf:"varint,1,opt,name=disabled,proto3" json:"disabled,omitempty"`
}
func (*CachingOptions) Descriptor ¶ added in v1.4.0
func (*CachingOptions) Descriptor() ([]byte, []int)
func (*CachingOptions) Equal ¶ added in v1.4.0
func (this *CachingOptions) Equal(that interface{}) bool
func (*CachingOptions) GetDisabled ¶ added in v1.4.0
func (m *CachingOptions) GetDisabled() bool
func (*CachingOptions) GoString ¶ added in v1.4.0
func (this *CachingOptions) GoString() string
func (*CachingOptions) Marshal ¶ added in v1.4.0
func (m *CachingOptions) Marshal() (dAtA []byte, err error)
func (*CachingOptions) MarshalTo ¶ added in v1.4.0
func (m *CachingOptions) MarshalTo(dAtA []byte) (int, error)
func (*CachingOptions) MarshalToSizedBuffer ¶ added in v1.4.0
func (m *CachingOptions) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CachingOptions) ProtoMessage ¶ added in v1.4.0
func (*CachingOptions) ProtoMessage()
func (*CachingOptions) Reset ¶ added in v1.4.0
func (m *CachingOptions) Reset()
func (*CachingOptions) Size ¶ added in v1.4.0
func (m *CachingOptions) Size() (n int)
func (*CachingOptions) String ¶ added in v1.4.0
func (this *CachingOptions) String() string
func (*CachingOptions) Unmarshal ¶ added in v1.4.0
func (m *CachingOptions) Unmarshal(dAtA []byte) error
func (*CachingOptions) XXX_DiscardUnknown ¶ added in v1.4.0
func (m *CachingOptions) XXX_DiscardUnknown()
func (*CachingOptions) XXX_Marshal ¶ added in v1.4.0
func (m *CachingOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CachingOptions) XXX_Merge ¶ added in v1.4.0
func (m *CachingOptions) XXX_Merge(src proto.Message)
func (*CachingOptions) XXX_Size ¶ added in v1.4.0
func (m *CachingOptions) XXX_Size() int
func (*CachingOptions) XXX_Unmarshal ¶ added in v1.4.0
func (m *CachingOptions) XXX_Unmarshal(b []byte) error
type Codec ¶ added in v0.4.0
type Codec interface { Merger // DecodeRequest decodes a Request from an http request. DecodeRequest(_ context.Context, request *http.Request, forwardHeaders []string) (Request, 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, Request) (Response, error) // EncodeRequest encodes a Request into an http request. EncodeRequest(context.Context, Request) (*http.Request, error) // EncodeResponse encodes a Response into an http response. EncodeResponse(context.Context, Response) (*http.Response, error) }
Codec is used to encode/decode query range requests and responses so they can be passed down to middlewares.
var ( // PrometheusCodec is a codec to encode and decode Prometheus query range requests and responses. PrometheusCodec Codec = &prometheusCodec{} )
type Config ¶ added in v0.4.0
type Config struct { SplitQueriesByInterval time.Duration `yaml:"split_queries_by_interval"` AlignQueriesWithStep bool `yaml:"align_queries_with_step"` ResultsCacheConfig `yaml:"results_cache"` CacheResults bool `yaml:"cache_results"` MaxRetries int `yaml:"max_retries"` ShardedQueries bool `yaml:"parallelise_shardable_queries"` // List of headers which query_range middleware chain would forward to downstream querier. ForwardHeaders flagext.StringSlice `yaml:"forward_headers_list"` }
Config for query_range middleware chain.
func (*Config) RegisterFlags ¶ added in v0.4.0
RegisterFlags adds the flags required to config this to the given FlagSet.
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"` }
func (*Extent) Descriptor ¶
func (*Extent) GetResponse ¶
func (*Extent) GetTraceId ¶
func (*Extent) MarshalToSizedBuffer ¶ added in v0.7.0
func (*Extent) ProtoMessage ¶
func (*Extent) ProtoMessage()
func (*Extent) XXX_DiscardUnknown ¶
func (m *Extent) XXX_DiscardUnknown()
func (*Extent) XXX_Marshal ¶
func (*Extent) XXX_Unmarshal ¶
type Extractor ¶ added in v0.4.0
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 ResponseWithoutStats(resp Response) Response }
Extractor is used by the cache to extract a subset of a response from a cache entry.
type HandlerFunc ¶
HandlerFunc is like http.HandlerFunc, but for Handler.
type InstrumentMiddlewareMetrics ¶ added in v0.7.0
type InstrumentMiddlewareMetrics struct {
// contains filtered or unexported fields
}
InstrumentMiddlewareMetrics holds the metrics tracked by InstrumentMiddleware.
func NewInstrumentMiddlewareMetrics ¶ added in v0.7.0
func NewInstrumentMiddlewareMetrics(registerer prometheus.Registerer) *InstrumentMiddlewareMetrics
NewInstrumentMiddlewareMetrics makes a new InstrumentMiddlewareMetrics.
type IntervalFn ¶ added in v1.4.0
type Limits ¶
type Limits interface { // MaxQueryLookback returns the max lookback period of queries. MaxQueryLookback(userID string) time.Duration // MaxQueryLength returns the limit of the length (in time) of a query. MaxQueryLength(string) time.Duration // MaxQueryParallelism returns the limit to the number of split queries the // frontend will process in parallel. MaxQueryParallelism(string) int // MaxCacheFreshness returns the period after which results are cacheable, // to prevent caching of very recent results. MaxCacheFreshness(string) time.Duration }
Limits allows us to specify per-tenant runtime limits on the behavior of the query handling code.
type Merger ¶ added in v0.4.0
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 Middleware ¶
Middleware is a higher order Handler.
func InstrumentMiddleware ¶
func InstrumentMiddleware(name string, metrics *InstrumentMiddlewareMetrics) Middleware
InstrumentMiddleware can be inserted into the middleware chain to expose timing information.
func MergeMiddlewares ¶
func MergeMiddlewares(middleware ...Middleware) Middleware
MergeMiddlewares produces a middleware that applies multiple middleware in turn; ie Merge(f,g,h).Wrap(handler) == f.Wrap(g.Wrap(h.Wrap(handler)))
func NewLimitsMiddleware ¶ added in v1.6.0
func NewLimitsMiddleware(l Limits) Middleware
NewLimitsMiddleware creates a new Middleware that enforces query limits.
func NewQueryShardMiddleware ¶ added in v0.7.0
func NewQueryShardMiddleware( logger log.Logger, engine *promql.Engine, confs ShardingConfigs, codec Codec, minShardingLookback time.Duration, metrics *InstrumentMiddlewareMetrics, registerer prometheus.Registerer, ) Middleware
NewQueryShardMiddleware creates a middleware which downstreams queries after AST mapping and query encoding.
func NewResultsCacheMiddleware ¶
func NewResultsCacheMiddleware( logger log.Logger, cfg ResultsCacheConfig, splitter CacheSplitter, limits Limits, merger Merger, extractor Extractor, cacheGenNumberLoader CacheGenNumberLoader, shouldCache ShouldCacheFn, reg prometheus.Registerer, ) (Middleware, cache.Cache, error)
NewResultsCacheMiddleware creates results cache middleware from config. The middleware cache result using a unique cache key for a given request (step,query,user) and interval. The cache assumes that each request length (end-start) is below or equal the interval. Each request starting from within the same interval will hit the same cache entry. If the cache doesn't have the entire duration of the request cached, it will query the uncached parts and append them to the cache entries. see `generateKey`.
func NewRetryMiddleware ¶
func NewRetryMiddleware(log log.Logger, maxRetries int, metrics *RetryMiddlewareMetrics) Middleware
NewRetryMiddleware returns a middleware that retries requests if they fail with 500 or a non-HTTP error.
func SplitByIntervalMiddleware ¶ added in v0.4.0
func SplitByIntervalMiddleware(interval IntervalFn, limits Limits, merger Merger, registerer prometheus.Registerer) Middleware
SplitByIntervalMiddleware creates a new Middleware that splits requests by a given interval.
type MiddlewareFunc ¶
MiddlewareFunc is like http.HandlerFunc, but for Middleware.
func (MiddlewareFunc) Wrap ¶
func (q MiddlewareFunc) Wrap(h Handler) Handler
Wrap implements Middleware.
type MockShardedQueryable ¶ added in v0.7.0
type MockShardedQueryable struct {
// contains filtered or unexported fields
}
MockShardedQueryable is exported to be reused in the querysharding benchmarking
func NewMockShardedQueryable ¶ added in v0.7.0
func NewMockShardedQueryable( nSamples int, labelSet []string, labelBuckets int, delayPerSeries time.Duration, ) *MockShardedQueryable
NewMockShardedQueryable creates a shard-aware in memory queryable.
func (*MockShardedQueryable) Close ¶ added in v0.7.0
func (q *MockShardedQueryable) Close() error
Close releases the resources of the Querier.
func (*MockShardedQueryable) LabelNames ¶ added in v0.7.0
func (q *MockShardedQueryable) LabelNames(matchers ...*labels.Matcher) ([]string, storage.Warnings, error)
LabelNames returns all the unique label names present in the block in sorted order.
func (*MockShardedQueryable) LabelValues ¶ added in v0.7.0
func (q *MockShardedQueryable) LabelValues(name string, matchers ...*labels.Matcher) ([]string, storage.Warnings, error)
LabelValues impls storage.Querier
func (*MockShardedQueryable) Querier ¶ added in v0.7.0
func (q *MockShardedQueryable) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error)
Querier impls storage.Queryable
func (*MockShardedQueryable) Select ¶ added in v0.7.0
func (q *MockShardedQueryable) Select(_ bool, _ *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet
Select implements storage.Querier interface. The bool passed is ignored because the series is always sorted.
type NoopCollector ¶ added in v0.7.0
type NoopCollector struct{}
NoopCollector is a noop collector that can be used as placeholder when no metric should tracked by the instrumentation.
func (*NoopCollector) Register ¶ added in v0.7.0
func (c *NoopCollector) Register()
Register implements instrument.Collector.
type PrometheusData ¶ added in v0.4.0
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"` Stats *PrometheusResponseStats `protobuf:"bytes,3,opt,name=stats,proto3" json:"stats,omitempty"` }
func (*PrometheusData) Descriptor ¶ added in v0.4.0
func (*PrometheusData) Descriptor() ([]byte, []int)
func (*PrometheusData) Equal ¶ added in v0.4.0
func (this *PrometheusData) Equal(that interface{}) bool
func (*PrometheusData) GetResult ¶ added in v0.4.0
func (m *PrometheusData) GetResult() []SampleStream
func (*PrometheusData) GetResultType ¶ added in v0.4.0
func (m *PrometheusData) GetResultType() string
func (*PrometheusData) GetStats ¶ added in v1.13.0
func (m *PrometheusData) GetStats() *PrometheusResponseStats
func (*PrometheusData) GoString ¶ added in v0.4.0
func (this *PrometheusData) GoString() string
func (*PrometheusData) Marshal ¶ added in v0.4.0
func (m *PrometheusData) Marshal() (dAtA []byte, err error)
func (*PrometheusData) MarshalTo ¶ added in v0.4.0
func (m *PrometheusData) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusData) MarshalToSizedBuffer ¶ added in v0.7.0
func (m *PrometheusData) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusData) ProtoMessage ¶ added in v0.4.0
func (*PrometheusData) ProtoMessage()
func (*PrometheusData) Reset ¶ added in v0.4.0
func (m *PrometheusData) Reset()
func (*PrometheusData) Size ¶ added in v0.4.0
func (m *PrometheusData) Size() (n int)
func (*PrometheusData) String ¶ added in v0.4.0
func (this *PrometheusData) String() string
func (*PrometheusData) Unmarshal ¶ added in v0.4.0
func (m *PrometheusData) Unmarshal(dAtA []byte) error
func (*PrometheusData) XXX_DiscardUnknown ¶ added in v0.4.0
func (m *PrometheusData) XXX_DiscardUnknown()
func (*PrometheusData) XXX_Marshal ¶ added in v0.4.0
func (m *PrometheusData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusData) XXX_Merge ¶ added in v0.4.0
func (m *PrometheusData) XXX_Merge(src proto.Message)
func (*PrometheusData) XXX_Size ¶ added in v0.4.0
func (m *PrometheusData) XXX_Size() int
func (*PrometheusData) XXX_Unmarshal ¶ added in v0.4.0
func (m *PrometheusData) XXX_Unmarshal(b []byte) error
type PrometheusRequest ¶ added in v0.4.0
type PrometheusRequest struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` Start int64 `protobuf:"varint,2,opt,name=start,proto3" json:"start,omitempty"` End int64 `protobuf:"varint,3,opt,name=end,proto3" json:"end,omitempty"` Step int64 `protobuf:"varint,4,opt,name=step,proto3" json:"step,omitempty"` Timeout time.Duration `protobuf:"bytes,5,opt,name=timeout,proto3,stdduration" json:"timeout"` Query string `protobuf:"bytes,6,opt,name=query,proto3" json:"query,omitempty"` CachingOptions CachingOptions `protobuf:"bytes,7,opt,name=cachingOptions,proto3" json:"cachingOptions"` Headers []*PrometheusRequestHeader `protobuf:"bytes,8,rep,name=Headers,proto3" json:"-"` Stats string `protobuf:"bytes,9,opt,name=stats,proto3" json:"stats,omitempty"` }
func (*PrometheusRequest) Descriptor ¶ added in v0.4.0
func (*PrometheusRequest) Descriptor() ([]byte, []int)
func (*PrometheusRequest) Equal ¶ added in v0.4.0
func (this *PrometheusRequest) Equal(that interface{}) bool
func (*PrometheusRequest) GetCachingOptions ¶ added in v1.4.0
func (m *PrometheusRequest) GetCachingOptions() CachingOptions
func (*PrometheusRequest) GetEnd ¶ added in v0.4.0
func (m *PrometheusRequest) GetEnd() int64
func (*PrometheusRequest) GetHeaders ¶ added in v1.13.0
func (m *PrometheusRequest) GetHeaders() []*PrometheusRequestHeader
func (*PrometheusRequest) GetPath ¶ added in v0.4.0
func (m *PrometheusRequest) GetPath() string
func (*PrometheusRequest) GetQuery ¶ added in v0.4.0
func (m *PrometheusRequest) GetQuery() string
func (*PrometheusRequest) GetStart ¶ added in v0.4.0
func (m *PrometheusRequest) GetStart() int64
func (*PrometheusRequest) GetStats ¶ added in v1.13.0
func (m *PrometheusRequest) GetStats() string
func (*PrometheusRequest) GetStep ¶ added in v0.4.0
func (m *PrometheusRequest) GetStep() int64
func (*PrometheusRequest) GetTimeout ¶ added in v0.4.0
func (m *PrometheusRequest) GetTimeout() time.Duration
func (*PrometheusRequest) GoString ¶ added in v0.4.0
func (this *PrometheusRequest) GoString() string
func (*PrometheusRequest) LogToSpan ¶ added in v1.2.0
func (q *PrometheusRequest) LogToSpan(sp opentracing.Span)
LogToSpan logs the current `PrometheusRequest` parameters to the specified span.
func (*PrometheusRequest) Marshal ¶ added in v0.4.0
func (m *PrometheusRequest) Marshal() (dAtA []byte, err error)
func (*PrometheusRequest) MarshalTo ¶ added in v0.4.0
func (m *PrometheusRequest) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusRequest) MarshalToSizedBuffer ¶ added in v0.7.0
func (m *PrometheusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusRequest) ProtoMessage ¶ added in v0.4.0
func (*PrometheusRequest) ProtoMessage()
func (*PrometheusRequest) Reset ¶ added in v0.4.0
func (m *PrometheusRequest) Reset()
func (*PrometheusRequest) Size ¶ added in v0.4.0
func (m *PrometheusRequest) Size() (n int)
func (*PrometheusRequest) String ¶ added in v0.4.0
func (this *PrometheusRequest) String() string
func (*PrometheusRequest) Unmarshal ¶ added in v0.4.0
func (m *PrometheusRequest) Unmarshal(dAtA []byte) error
func (*PrometheusRequest) WithQuery ¶ added in v0.7.0
func (q *PrometheusRequest) WithQuery(query string) Request
WithQuery clones the current `PrometheusRequest` with a new query.
func (*PrometheusRequest) WithStartEnd ¶ added in v0.4.0
func (q *PrometheusRequest) WithStartEnd(start int64, end int64) Request
WithStartEnd clones the current `PrometheusRequest` with a new `start` and `end` timestamp.
func (*PrometheusRequest) WithStats ¶ added in v1.13.0
func (q *PrometheusRequest) WithStats(stats string) Request
WithStats clones the current `PrometheusRequest` with a new stats.
func (*PrometheusRequest) XXX_DiscardUnknown ¶ added in v0.4.0
func (m *PrometheusRequest) XXX_DiscardUnknown()
func (*PrometheusRequest) XXX_Marshal ¶ added in v0.4.0
func (m *PrometheusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusRequest) XXX_Merge ¶ added in v0.4.0
func (m *PrometheusRequest) XXX_Merge(src proto.Message)
func (*PrometheusRequest) XXX_Size ¶ added in v0.4.0
func (m *PrometheusRequest) XXX_Size() int
func (*PrometheusRequest) XXX_Unmarshal ¶ added in v0.4.0
func (m *PrometheusRequest) XXX_Unmarshal(b []byte) error
type PrometheusRequestHeader ¶ added in v1.13.0
type PrometheusRequestHeader struct { Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"-"` Values []string `protobuf:"bytes,2,rep,name=Values,proto3" json:"-"` }
func (*PrometheusRequestHeader) Descriptor ¶ added in v1.13.0
func (*PrometheusRequestHeader) Descriptor() ([]byte, []int)
func (*PrometheusRequestHeader) Equal ¶ added in v1.13.0
func (this *PrometheusRequestHeader) Equal(that interface{}) bool
func (*PrometheusRequestHeader) GetName ¶ added in v1.13.0
func (m *PrometheusRequestHeader) GetName() string
func (*PrometheusRequestHeader) GetValues ¶ added in v1.13.0
func (m *PrometheusRequestHeader) GetValues() []string
func (*PrometheusRequestHeader) GoString ¶ added in v1.13.0
func (this *PrometheusRequestHeader) GoString() string
func (*PrometheusRequestHeader) Marshal ¶ added in v1.13.0
func (m *PrometheusRequestHeader) Marshal() (dAtA []byte, err error)
func (*PrometheusRequestHeader) MarshalTo ¶ added in v1.13.0
func (m *PrometheusRequestHeader) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusRequestHeader) MarshalToSizedBuffer ¶ added in v1.13.0
func (m *PrometheusRequestHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusRequestHeader) ProtoMessage ¶ added in v1.13.0
func (*PrometheusRequestHeader) ProtoMessage()
func (*PrometheusRequestHeader) Reset ¶ added in v1.13.0
func (m *PrometheusRequestHeader) Reset()
func (*PrometheusRequestHeader) Size ¶ added in v1.13.0
func (m *PrometheusRequestHeader) Size() (n int)
func (*PrometheusRequestHeader) String ¶ added in v1.13.0
func (this *PrometheusRequestHeader) String() string
func (*PrometheusRequestHeader) Unmarshal ¶ added in v1.13.0
func (m *PrometheusRequestHeader) Unmarshal(dAtA []byte) error
func (*PrometheusRequestHeader) XXX_DiscardUnknown ¶ added in v1.13.0
func (m *PrometheusRequestHeader) XXX_DiscardUnknown()
func (*PrometheusRequestHeader) XXX_Marshal ¶ added in v1.13.0
func (m *PrometheusRequestHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusRequestHeader) XXX_Merge ¶ added in v1.13.0
func (m *PrometheusRequestHeader) XXX_Merge(src proto.Message)
func (*PrometheusRequestHeader) XXX_Size ¶ added in v1.13.0
func (m *PrometheusRequestHeader) XXX_Size() int
func (*PrometheusRequestHeader) XXX_Unmarshal ¶ added in v1.13.0
func (m *PrometheusRequestHeader) XXX_Unmarshal(b []byte) error
type PrometheusResponse ¶ added in v0.4.0
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:"-"` }
func NewEmptyPrometheusResponse ¶ added in v1.6.0
func NewEmptyPrometheusResponse() *PrometheusResponse
NewEmptyPrometheusResponse returns an empty successful Prometheus query range response.
func (*PrometheusResponse) Descriptor ¶ added in v0.4.0
func (*PrometheusResponse) Descriptor() ([]byte, []int)
func (*PrometheusResponse) Equal ¶ added in v0.4.0
func (this *PrometheusResponse) Equal(that interface{}) bool
func (*PrometheusResponse) GetData ¶ added in v0.4.0
func (m *PrometheusResponse) GetData() PrometheusData
func (*PrometheusResponse) GetError ¶ added in v0.4.0
func (m *PrometheusResponse) GetError() string
func (*PrometheusResponse) GetErrorType ¶ added in v0.4.0
func (m *PrometheusResponse) GetErrorType() string
func (*PrometheusResponse) GetHeaders ¶ added in v0.6.0
func (m *PrometheusResponse) GetHeaders() []*PrometheusResponseHeader
func (*PrometheusResponse) GetStatus ¶ added in v0.4.0
func (m *PrometheusResponse) GetStatus() string
func (*PrometheusResponse) GoString ¶ added in v0.4.0
func (this *PrometheusResponse) GoString() string
func (*PrometheusResponse) Marshal ¶ added in v0.4.0
func (m *PrometheusResponse) Marshal() (dAtA []byte, err error)
func (*PrometheusResponse) MarshalTo ¶ added in v0.4.0
func (m *PrometheusResponse) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusResponse) MarshalToSizedBuffer ¶ added in v0.7.0
func (m *PrometheusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusResponse) ProtoMessage ¶ added in v0.4.0
func (*PrometheusResponse) ProtoMessage()
func (*PrometheusResponse) Reset ¶ added in v0.4.0
func (m *PrometheusResponse) Reset()
func (*PrometheusResponse) Size ¶ added in v0.4.0
func (m *PrometheusResponse) Size() (n int)
func (*PrometheusResponse) String ¶ added in v0.4.0
func (this *PrometheusResponse) String() string
func (*PrometheusResponse) Unmarshal ¶ added in v0.4.0
func (m *PrometheusResponse) Unmarshal(dAtA []byte) error
func (*PrometheusResponse) XXX_DiscardUnknown ¶ added in v0.4.0
func (m *PrometheusResponse) XXX_DiscardUnknown()
func (*PrometheusResponse) XXX_Marshal ¶ added in v0.4.0
func (m *PrometheusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusResponse) XXX_Merge ¶ added in v0.4.0
func (m *PrometheusResponse) XXX_Merge(src proto.Message)
func (*PrometheusResponse) XXX_Size ¶ added in v0.4.0
func (m *PrometheusResponse) XXX_Size() int
func (*PrometheusResponse) XXX_Unmarshal ¶ added in v0.4.0
func (m *PrometheusResponse) XXX_Unmarshal(b []byte) error
type PrometheusResponseExtractor ¶ added in v0.4.0
type PrometheusResponseExtractor struct{}
PrometheusResponseExtractor helps extracting specific info from Query Response.
func (PrometheusResponseExtractor) Extract ¶ added in v1.1.0
func (PrometheusResponseExtractor) Extract(start, end int64, from Response) Response
Extract extracts response for specific a range from a response.
func (PrometheusResponseExtractor) ResponseWithoutHeaders ¶ added in v1.1.0
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.
func (PrometheusResponseExtractor) ResponseWithoutStats ¶ added in v1.13.0
func (PrometheusResponseExtractor) ResponseWithoutStats(resp Response) Response
ResponseWithoutStats is returns the response without the stats information
type PrometheusResponseHeader ¶ added in v0.6.0
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 ¶ added in v0.6.0
func (*PrometheusResponseHeader) Descriptor() ([]byte, []int)
func (*PrometheusResponseHeader) Equal ¶ added in v0.6.0
func (this *PrometheusResponseHeader) Equal(that interface{}) bool
func (*PrometheusResponseHeader) GetName ¶ added in v0.6.0
func (m *PrometheusResponseHeader) GetName() string
func (*PrometheusResponseHeader) GetValues ¶ added in v0.6.0
func (m *PrometheusResponseHeader) GetValues() []string
func (*PrometheusResponseHeader) GoString ¶ added in v0.6.0
func (this *PrometheusResponseHeader) GoString() string
func (*PrometheusResponseHeader) Marshal ¶ added in v0.6.0
func (m *PrometheusResponseHeader) Marshal() (dAtA []byte, err error)
func (*PrometheusResponseHeader) MarshalTo ¶ added in v0.6.0
func (m *PrometheusResponseHeader) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusResponseHeader) MarshalToSizedBuffer ¶ added in v0.7.0
func (m *PrometheusResponseHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusResponseHeader) ProtoMessage ¶ added in v0.6.0
func (*PrometheusResponseHeader) ProtoMessage()
func (*PrometheusResponseHeader) Reset ¶ added in v0.6.0
func (m *PrometheusResponseHeader) Reset()
func (*PrometheusResponseHeader) Size ¶ added in v0.6.0
func (m *PrometheusResponseHeader) Size() (n int)
func (*PrometheusResponseHeader) String ¶ added in v0.6.0
func (this *PrometheusResponseHeader) String() string
func (*PrometheusResponseHeader) Unmarshal ¶ added in v0.6.0
func (m *PrometheusResponseHeader) Unmarshal(dAtA []byte) error
func (*PrometheusResponseHeader) XXX_DiscardUnknown ¶ added in v0.6.0
func (m *PrometheusResponseHeader) XXX_DiscardUnknown()
func (*PrometheusResponseHeader) XXX_Marshal ¶ added in v0.6.0
func (m *PrometheusResponseHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusResponseHeader) XXX_Merge ¶ added in v0.6.0
func (m *PrometheusResponseHeader) XXX_Merge(src proto.Message)
func (*PrometheusResponseHeader) XXX_Size ¶ added in v0.6.0
func (m *PrometheusResponseHeader) XXX_Size() int
func (*PrometheusResponseHeader) XXX_Unmarshal ¶ added in v0.6.0
func (m *PrometheusResponseHeader) XXX_Unmarshal(b []byte) error
type PrometheusResponseQueryableSamplesStatsPerStep ¶ added in v1.13.0
type PrometheusResponseQueryableSamplesStatsPerStep struct { Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` TimestampMs int64 `protobuf:"varint,2,opt,name=timestamp_ms,json=timestampMs,proto3" json:"timestamp_ms,omitempty"` }
func (*PrometheusResponseQueryableSamplesStatsPerStep) Descriptor ¶ added in v1.13.0
func (*PrometheusResponseQueryableSamplesStatsPerStep) Descriptor() ([]byte, []int)
func (*PrometheusResponseQueryableSamplesStatsPerStep) Equal ¶ added in v1.13.0
func (this *PrometheusResponseQueryableSamplesStatsPerStep) Equal(that interface{}) bool
func (*PrometheusResponseQueryableSamplesStatsPerStep) GetTimestampMs ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) GetTimestampMs() int64
func (*PrometheusResponseQueryableSamplesStatsPerStep) GetValue ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) GetValue() int64
func (*PrometheusResponseQueryableSamplesStatsPerStep) GoString ¶ added in v1.13.0
func (this *PrometheusResponseQueryableSamplesStatsPerStep) GoString() string
func (*PrometheusResponseQueryableSamplesStatsPerStep) Marshal ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) Marshal() (dAtA []byte, err error)
func (*PrometheusResponseQueryableSamplesStatsPerStep) MarshalTo ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusResponseQueryableSamplesStatsPerStep) MarshalToSizedBuffer ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusResponseQueryableSamplesStatsPerStep) ProtoMessage ¶ added in v1.13.0
func (*PrometheusResponseQueryableSamplesStatsPerStep) ProtoMessage()
func (*PrometheusResponseQueryableSamplesStatsPerStep) Reset ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) Reset()
func (*PrometheusResponseQueryableSamplesStatsPerStep) Size ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) Size() (n int)
func (*PrometheusResponseQueryableSamplesStatsPerStep) String ¶ added in v1.13.0
func (this *PrometheusResponseQueryableSamplesStatsPerStep) String() string
func (*PrometheusResponseQueryableSamplesStatsPerStep) Unmarshal ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) Unmarshal(dAtA []byte) error
func (*PrometheusResponseQueryableSamplesStatsPerStep) XXX_DiscardUnknown ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_DiscardUnknown()
func (*PrometheusResponseQueryableSamplesStatsPerStep) XXX_Marshal ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusResponseQueryableSamplesStatsPerStep) XXX_Merge ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_Merge(src proto.Message)
func (*PrometheusResponseQueryableSamplesStatsPerStep) XXX_Size ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_Size() int
func (*PrometheusResponseQueryableSamplesStatsPerStep) XXX_Unmarshal ¶ added in v1.13.0
func (m *PrometheusResponseQueryableSamplesStatsPerStep) XXX_Unmarshal(b []byte) error
type PrometheusResponseSamplesStats ¶ added in v1.13.0
type PrometheusResponseSamplesStats struct { TotalQueryableSamples int64 `protobuf:"varint,1,opt,name=totalQueryableSamples,proto3" json:"totalQueryableSamples"` TotalQueryableSamplesPerStep []*PrometheusResponseQueryableSamplesStatsPerStep `protobuf:"bytes,2,rep,name=totalQueryableSamplesPerStep,proto3" json:"totalQueryableSamplesPerStep"` }
func (*PrometheusResponseSamplesStats) Descriptor ¶ added in v1.13.0
func (*PrometheusResponseSamplesStats) Descriptor() ([]byte, []int)
func (*PrometheusResponseSamplesStats) Equal ¶ added in v1.13.0
func (this *PrometheusResponseSamplesStats) Equal(that interface{}) bool
func (*PrometheusResponseSamplesStats) GetTotalQueryableSamples ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) GetTotalQueryableSamples() int64
func (*PrometheusResponseSamplesStats) GetTotalQueryableSamplesPerStep ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) GetTotalQueryableSamplesPerStep() []*PrometheusResponseQueryableSamplesStatsPerStep
func (*PrometheusResponseSamplesStats) GoString ¶ added in v1.13.0
func (this *PrometheusResponseSamplesStats) GoString() string
func (*PrometheusResponseSamplesStats) Marshal ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) Marshal() (dAtA []byte, err error)
func (*PrometheusResponseSamplesStats) MarshalTo ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusResponseSamplesStats) MarshalToSizedBuffer ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusResponseSamplesStats) ProtoMessage ¶ added in v1.13.0
func (*PrometheusResponseSamplesStats) ProtoMessage()
func (*PrometheusResponseSamplesStats) Reset ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) Reset()
func (*PrometheusResponseSamplesStats) Size ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) Size() (n int)
func (*PrometheusResponseSamplesStats) String ¶ added in v1.13.0
func (this *PrometheusResponseSamplesStats) String() string
func (*PrometheusResponseSamplesStats) Unmarshal ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) Unmarshal(dAtA []byte) error
func (*PrometheusResponseSamplesStats) XXX_DiscardUnknown ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) XXX_DiscardUnknown()
func (*PrometheusResponseSamplesStats) XXX_Marshal ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusResponseSamplesStats) XXX_Merge ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) XXX_Merge(src proto.Message)
func (*PrometheusResponseSamplesStats) XXX_Size ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) XXX_Size() int
func (*PrometheusResponseSamplesStats) XXX_Unmarshal ¶ added in v1.13.0
func (m *PrometheusResponseSamplesStats) XXX_Unmarshal(b []byte) error
type PrometheusResponseStats ¶ added in v1.13.0
type PrometheusResponseStats struct {
Samples *PrometheusResponseSamplesStats `protobuf:"bytes,1,opt,name=samples,proto3" json:"samples"`
}
func (*PrometheusResponseStats) Descriptor ¶ added in v1.13.0
func (*PrometheusResponseStats) Descriptor() ([]byte, []int)
func (*PrometheusResponseStats) Equal ¶ added in v1.13.0
func (this *PrometheusResponseStats) Equal(that interface{}) bool
func (*PrometheusResponseStats) GetSamples ¶ added in v1.13.0
func (m *PrometheusResponseStats) GetSamples() *PrometheusResponseSamplesStats
func (*PrometheusResponseStats) GoString ¶ added in v1.13.0
func (this *PrometheusResponseStats) GoString() string
func (*PrometheusResponseStats) Marshal ¶ added in v1.13.0
func (m *PrometheusResponseStats) Marshal() (dAtA []byte, err error)
func (*PrometheusResponseStats) MarshalTo ¶ added in v1.13.0
func (m *PrometheusResponseStats) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusResponseStats) MarshalToSizedBuffer ¶ added in v1.13.0
func (m *PrometheusResponseStats) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusResponseStats) ProtoMessage ¶ added in v1.13.0
func (*PrometheusResponseStats) ProtoMessage()
func (*PrometheusResponseStats) Reset ¶ added in v1.13.0
func (m *PrometheusResponseStats) Reset()
func (*PrometheusResponseStats) Size ¶ added in v1.13.0
func (m *PrometheusResponseStats) Size() (n int)
func (*PrometheusResponseStats) String ¶ added in v1.13.0
func (this *PrometheusResponseStats) String() string
func (*PrometheusResponseStats) Unmarshal ¶ added in v1.13.0
func (m *PrometheusResponseStats) Unmarshal(dAtA []byte) error
func (*PrometheusResponseStats) XXX_DiscardUnknown ¶ added in v1.13.0
func (m *PrometheusResponseStats) XXX_DiscardUnknown()
func (*PrometheusResponseStats) XXX_Marshal ¶ added in v1.13.0
func (m *PrometheusResponseStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusResponseStats) XXX_Merge ¶ added in v1.13.0
func (m *PrometheusResponseStats) XXX_Merge(src proto.Message)
func (*PrometheusResponseStats) XXX_Size ¶ added in v1.13.0
func (m *PrometheusResponseStats) XXX_Size() int
func (*PrometheusResponseStats) XXX_Unmarshal ¶ added in v1.13.0
func (m *PrometheusResponseStats) XXX_Unmarshal(b []byte) error
type Request ¶
type Request interface { // 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 // GetCachingOptions returns the caching options. GetCachingOptions() CachingOptions // WithStartEnd clone the current request with different start and end timestamp. WithStartEnd(startTime int64, endTime int64) Request // WithQuery clone the current request with a different query. WithQuery(string) Request proto.Message // LogToSpan writes information about this request to an OpenTracing span LogToSpan(opentracing.Span) // GetStats returns the stats of the request. GetStats() string // WithStats clones the current `PrometheusRequest` with a new stats. WithStats(stats string) Request }
Request represents a query range request that can be process by middlewares.
type RequestResponse ¶ added in v0.6.0
RequestResponse contains a request response and the respective request that was used.
func DoRequests ¶ added in v0.6.0
func DoRequests(ctx context.Context, downstream Handler, reqs []Request, limits Limits) ([]RequestResponse, error)
DoRequests executes a list of requests in parallel. The limits parameters is used to limit parallelism per single request.
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 { CacheConfig cache.Config `yaml:"cache"` Compression string `yaml:"compression"` CacheQueryableSamplesStats bool `yaml:"cache_queryable_samples_stats"` }
ResultsCacheConfig is the config for the results cache.
func (*ResultsCacheConfig) RegisterFlags ¶
func (cfg *ResultsCacheConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags registers flags.
type RetryMiddlewareMetrics ¶ added in v0.7.0
type RetryMiddlewareMetrics struct {
// contains filtered or unexported fields
}
func NewRetryMiddlewareMetrics ¶ added in v0.7.0
func NewRetryMiddlewareMetrics(registerer prometheus.Registerer) *RetryMiddlewareMetrics
type RoundTripFunc ¶ added in v1.6.0
RoundTripFunc is to http.RoundTripper what http.HandlerFunc is to http.Handler.
type SampleStream ¶
type SampleStream struct { Labels []github_com_cortexproject_cortex_pkg_cortexpb.LabelAdapter `protobuf:"bytes,1,rep,name=labels,proto3,customtype=github.com/cortexproject/cortex/pkg/cortexpb.LabelAdapter" json:"metric"` Samples []cortexpb.Sample `protobuf:"bytes,2,rep,name=samples,proto3" json:"values"` }
func FromResult ¶ added in v0.7.0
func FromResult(res *promql.Result) ([]SampleStream, error)
FromResult transforms a promql query result into a samplestream
func ResponseToSamples ¶ added in v0.7.0
func ResponseToSamples(resp Response) ([]SampleStream, error)
ResponseToSamples is needed to map back from api response to the underlying series data
func (*SampleStream) Descriptor ¶
func (*SampleStream) Descriptor() ([]byte, []int)
func (*SampleStream) Equal ¶
func (this *SampleStream) Equal(that interface{}) bool
func (*SampleStream) GetSamples ¶
func (m *SampleStream) GetSamples() []cortexpb.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) MarshalToSizedBuffer ¶ added in v0.7.0
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 ShardLabelSeries ¶ added in v0.7.0
ShardLabelSeries allows extending a Series with new labels. This is helpful for adding cortex shard labels
func (*ShardLabelSeries) Labels ¶ added in v0.7.0
func (s *ShardLabelSeries) Labels() labels.Labels
Labels impls storage.Series
type ShardedQuerier ¶ added in v0.7.0
type ShardedQuerier struct { Ctx context.Context Req Request Handler Handler ResponseHeaders map[string][]string ResponseHeadersMtx sync.Mutex }
ShardedQuerier is a an implementor of the Querier interface.
func (*ShardedQuerier) Close ¶ added in v0.7.0
func (q *ShardedQuerier) Close() error
Close releases the resources of the Querier.
func (*ShardedQuerier) LabelNames ¶ added in v0.7.0
func (q *ShardedQuerier) LabelNames(matchers ...*labels.Matcher) ([]string, storage.Warnings, error)
LabelNames returns all the unique label names present in the block in sorted order.
func (*ShardedQuerier) LabelValues ¶ added in v0.7.0
func (q *ShardedQuerier) LabelValues(name string, matchers ...*labels.Matcher) ([]string, storage.Warnings, error)
LabelValues returns all potential values for a label name.
func (*ShardedQuerier) Select ¶ added in v0.7.0
func (q *ShardedQuerier) Select(_ bool, _ *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet
Select returns a set of series that matches the given label matchers. The bool passed is ignored because the series is always sorted.
type ShardedQueryable ¶ added in v0.7.0
type ShardedQueryable struct { Req Request Handler Handler // contains filtered or unexported fields }
ShardedQueryable is an implementor of the Queryable interface.
type ShardingConfigs ¶ added in v0.7.0
type ShardingConfigs []chunk.PeriodConfig
ShardingConfigs is a slice of chunk shard configs
func (ShardingConfigs) GetConf ¶ added in v0.7.0
func (confs ShardingConfigs) GetConf(r Request) (chunk.PeriodConfig, error)
GetConf will extract a shardable config corresponding to a request and the shardingconfigs
func (ShardingConfigs) ValidRange ¶ added in v0.7.0
func (confs ShardingConfigs) ValidRange(start, end int64) (chunk.PeriodConfig, error)
ValidRange extracts a non-overlapping sharding configuration from a list of configs and a time range.
type ShouldCacheFn ¶ added in v1.4.0
ShouldCacheFn checks whether the current request should go to cache or not. If not, just send the request to next handler.
type Tripperware ¶ added in v1.6.0
type Tripperware func(http.RoundTripper) http.RoundTripper
Tripperware is a signature for all http client-side middleware.
func NewTripperware ¶ added in v0.4.0
func NewTripperware( cfg Config, log log.Logger, limits Limits, codec Codec, cacheExtractor Extractor, schema chunk.SchemaConfig, engineOpts promql.EngineOpts, minShardingLookback time.Duration, registerer prometheus.Registerer, cacheGenNumberLoader CacheGenNumberLoader, ) (Tripperware, cache.Cache, error)
NewTripperware returns a Tripperware configured with middlewares to limit, align, split, retry and cache requests.