Documentation ¶
Index ¶
- Variables
- func NewRoundTripper(next http.RoundTripper, handler Handler, limits Limits) http.RoundTripper
- func ParseTime(s string) (int64, error)
- type APIResponse
- func (*APIResponse) Descriptor() ([]byte, []int)
- func (this *APIResponse) Equal(that interface{}) bool
- func (m *APIResponse) GetData() Response
- func (m *APIResponse) GetError() string
- func (m *APIResponse) GetErrorType() string
- func (m *APIResponse) GetStatus() string
- func (this *APIResponse) GoString() string
- func (m *APIResponse) Marshal() (dAtA []byte, err error)
- func (m *APIResponse) MarshalTo(dAtA []byte) (int, error)
- func (*APIResponse) ProtoMessage()
- func (m *APIResponse) Reset()
- func (m *APIResponse) Size() (n int)
- func (this *APIResponse) String() string
- func (m *APIResponse) Unmarshal(dAtA []byte) error
- func (m *APIResponse) XXX_DiscardUnknown()
- func (m *APIResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *APIResponse) XXX_Merge(src proto.Message)
- func (m *APIResponse) XXX_Size() int
- func (m *APIResponse) XXX_Unmarshal(b []byte) error
- 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 (*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 Extent
- func (*Extent) Descriptor() ([]byte, []int)
- func (this *Extent) Equal(that interface{}) bool
- func (m *Extent) GetEnd() int64
- func (m *Extent) GetResponse() *APIResponse
- 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 (*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 Handler
- type HandlerFunc
- type Limits
- type Middleware
- func InstrumentMiddleware(name string, queryRangeDuration *prometheus.HistogramVec) Middleware
- func MergeMiddlewares(middleware ...Middleware) Middleware
- func NewResultsCacheMiddleware(logger log.Logger, cfg ResultsCacheConfig, limits Limits) (Middleware, error)
- func NewRetryMiddleware(log log.Logger, maxRetries int) Middleware
- func SplitByDayMiddleware(limits Limits) Middleware
- type MiddlewareFunc
- type Request
- func (*Request) Descriptor() ([]byte, []int)
- func (this *Request) Equal(that interface{}) bool
- func (m *Request) GetEnd() int64
- func (m *Request) GetPath() string
- func (m *Request) GetQuery() string
- func (m *Request) GetStart() int64
- func (m *Request) GetStep() int64
- func (m *Request) GetTimeout() time.Duration
- func (this *Request) GoString() string
- func (q Request) LogToSpan(ctx context.Context)
- func (m *Request) Marshal() (dAtA []byte, err error)
- func (m *Request) MarshalTo(dAtA []byte) (int, error)
- func (*Request) ProtoMessage()
- func (m *Request) Reset()
- func (m *Request) Size() (n int)
- func (this *Request) String() string
- func (m *Request) Unmarshal(dAtA []byte) error
- func (m *Request) XXX_DiscardUnknown()
- func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Request) XXX_Merge(src proto.Message)
- func (m *Request) XXX_Size() int
- func (m *Request) XXX_Unmarshal(b []byte) error
- type Response
- func (*Response) Descriptor() ([]byte, []int)
- func (this *Response) Equal(that interface{}) bool
- func (m *Response) GetResult() []SampleStream
- func (m *Response) GetResultType() string
- func (this *Response) GoString() string
- func (m *Response) Marshal() (dAtA []byte, err error)
- func (m *Response) MarshalTo(dAtA []byte) (int, error)
- func (*Response) ProtoMessage()
- func (m *Response) Reset()
- func (m *Response) Size() (n int)
- func (this *Response) String() string
- func (m *Response) Unmarshal(dAtA []byte) error
- func (m *Response) XXX_DiscardUnknown()
- func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Response) XXX_Merge(src proto.Message)
- func (m *Response) XXX_Size() int
- func (m *Response) XXX_Unmarshal(b []byte) error
- type ResultsCacheConfig
- type SampleStream
- func (*SampleStream) Descriptor() ([]byte, []int)
- func (this *SampleStream) Equal(that interface{}) bool
- func (m *SampleStream) GetSamples() []client.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 (*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 ToRoundTripperMiddleware
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthQueryrange = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowQueryrange = fmt.Errorf("proto: integer overflow") )
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, handler Handler, limits Limits) http.RoundTripper
NewRoundTripper wraps a QueryRange Handler and allows it to send requests to a http.Roundtripper.
Types ¶
type APIResponse ¶
type APIResponse struct { Status string `protobuf:"bytes,1,opt,name=Status,json=status,proto3" json:"status"` Data Response `protobuf:"bytes,2,opt,name=Data,json=data,proto3" json:"data,omitempty"` ErrorType string `protobuf:"bytes,3,opt,name=ErrorType,json=errorType,proto3" json:"errorType,omitempty"` Error string `protobuf:"bytes,4,opt,name=Error,json=error,proto3" json:"error,omitempty"` }
func (*APIResponse) Descriptor ¶
func (*APIResponse) Descriptor() ([]byte, []int)
func (*APIResponse) Equal ¶
func (this *APIResponse) Equal(that interface{}) bool
func (*APIResponse) GetData ¶
func (m *APIResponse) GetData() Response
func (*APIResponse) GetError ¶
func (m *APIResponse) GetError() string
func (*APIResponse) GetErrorType ¶
func (m *APIResponse) GetErrorType() string
func (*APIResponse) GetStatus ¶
func (m *APIResponse) GetStatus() string
func (*APIResponse) GoString ¶
func (this *APIResponse) GoString() string
func (*APIResponse) Marshal ¶
func (m *APIResponse) Marshal() (dAtA []byte, err error)
func (*APIResponse) ProtoMessage ¶
func (*APIResponse) ProtoMessage()
func (*APIResponse) Reset ¶
func (m *APIResponse) Reset()
func (*APIResponse) Size ¶
func (m *APIResponse) Size() (n int)
func (*APIResponse) String ¶
func (this *APIResponse) String() string
func (*APIResponse) Unmarshal ¶
func (m *APIResponse) Unmarshal(dAtA []byte) error
func (*APIResponse) XXX_DiscardUnknown ¶
func (m *APIResponse) XXX_DiscardUnknown()
func (*APIResponse) XXX_Marshal ¶
func (m *APIResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*APIResponse) XXX_Merge ¶
func (m *APIResponse) XXX_Merge(src proto.Message)
func (*APIResponse) XXX_Size ¶
func (m *APIResponse) XXX_Size() int
func (*APIResponse) XXX_Unmarshal ¶
func (m *APIResponse) 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) 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 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"` Response *APIResponse `protobuf:"bytes,3,opt,name=response,proto3" json:"response"` TraceId string `protobuf:"bytes,4,opt,name=trace_id,json=traceId,proto3" json:"-"` }
func (*Extent) Descriptor ¶
func (*Extent) GetResponse ¶
func (m *Extent) GetResponse() *APIResponse
func (*Extent) GetTraceId ¶
func (*Extent) ProtoMessage ¶
func (*Extent) ProtoMessage()
func (*Extent) XXX_DiscardUnknown ¶
func (m *Extent) XXX_DiscardUnknown()
func (*Extent) XXX_Marshal ¶
func (*Extent) XXX_Unmarshal ¶
type Handler ¶
type Handler interface {
Do(context.Context, *Request) (*APIResponse, error)
}
Handler is like http.Handle, but specifically for Prometheus query_range calls.
type HandlerFunc ¶
type HandlerFunc func(context.Context, *Request) (*APIResponse, error)
HandlerFunc is like http.HandlerFunc, but for Handler.
func (HandlerFunc) Do ¶
func (q HandlerFunc) Do(ctx context.Context, req *Request) (*APIResponse, error)
Do implements Handler.
type Limits ¶
Limits allows us to specify per-tenant runtime limits on the behaviour of the query handling code.
type Middleware ¶
Middleware is a higher order Handler.
func InstrumentMiddleware ¶
func InstrumentMiddleware(name string, queryRangeDuration *prometheus.HistogramVec) 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 NewResultsCacheMiddleware ¶
func NewResultsCacheMiddleware(logger log.Logger, cfg ResultsCacheConfig, limits Limits) (Middleware, error)
NewResultsCacheMiddleware creates results cache middleware from config.
func NewRetryMiddleware ¶
func NewRetryMiddleware(log log.Logger, maxRetries int) Middleware
NewRetryMiddleware returns a middleware that retries requests if they fail with 500 or a non-HTTP error.
func SplitByDayMiddleware ¶
func SplitByDayMiddleware(limits Limits) Middleware
SplitByDayMiddleware creates a new Middleware that splits requests by day.
type MiddlewareFunc ¶
MiddlewareFunc is like http.HandlerFunc, but for Middleware.
func (MiddlewareFunc) Wrap ¶
func (q MiddlewareFunc) Wrap(h Handler) Handler
Wrap implements Middleware.
type Request ¶
type Request 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"` }
func (*Request) Descriptor ¶
func (*Request) GetTimeout ¶
func (Request) LogToSpan ¶
LogToSpan writes information about this request to the OpenTracing span in the context, if there is one.
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) XXX_DiscardUnknown ¶
func (m *Request) XXX_DiscardUnknown()
func (*Request) XXX_Marshal ¶
func (*Request) XXX_Unmarshal ¶
type Response ¶
type Response struct { ResultType string `protobuf:"bytes,1,opt,name=ResultType,json=resultType,proto3" json:"resultType"` Result []SampleStream `protobuf:"bytes,2,rep,name=Result,json=result,proto3" json:"result"` }
func (*Response) Descriptor ¶
func (*Response) GetResult ¶
func (m *Response) GetResult() []SampleStream
func (*Response) GetResultType ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) XXX_DiscardUnknown ¶
func (m *Response) XXX_DiscardUnknown()
func (*Response) XXX_Marshal ¶
func (*Response) XXX_Unmarshal ¶
type ResultsCacheConfig ¶
type ResultsCacheConfig struct { CacheConfig cache.Config `yaml:"cache"` MaxCacheFreshness time.Duration `yaml:"max_freshness"` }
ResultsCacheConfig is the config for the results cache.
func (*ResultsCacheConfig) RegisterFlags ¶
func (cfg *ResultsCacheConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags registers flags.
type SampleStream ¶
type SampleStream struct { Labels []github_com_cortexproject_cortex_pkg_ingester_client.LabelAdapter `` /* 131-byte string literal not displayed */ Samples []client.Sample `protobuf:"bytes,2,rep,name=samples,proto3" json:"values"` }
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() []client.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) 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 ToRoundTripperMiddleware ¶
type ToRoundTripperMiddleware struct {
Next http.RoundTripper
}
ToRoundTripperMiddleware not quite sure what this does.
func (ToRoundTripperMiddleware) Do ¶
func (q ToRoundTripperMiddleware) Do(ctx context.Context, r *Request) (*APIResponse, error)
Do implements Handler.