queryrange

package
v0.3.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthQueryrange = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQueryrange   = fmt.Errorf("proto: integer overflow")
)
View Source
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.

func ParseTime

func ParseTime(s string) (int64, error)

ParseTime parses the string into an int64, milliseconds since epoch.

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) MarshalTo

func (m *APIResponse) MarshalTo(dAtA []byte) (int, 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) MarshalTo

func (m *CachedResponse) MarshalTo(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 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) Descriptor() ([]byte, []int)

func (*Extent) Equal

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

func (*Extent) GetEnd

func (m *Extent) GetEnd() int64

func (*Extent) GetResponse

func (m *Extent) GetResponse() *APIResponse

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) 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 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

type Limits interface {
	MaxQueryLength(string) time.Duration
	MaxQueryParallelism(string) int
}

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

type Middleware

type Middleware interface {
	Wrap(Handler) Handler
}

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

type MiddlewareFunc func(Handler) Handler

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) Descriptor() ([]byte, []int)

func (*Request) Equal

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

func (*Request) GetEnd

func (m *Request) GetEnd() int64

func (*Request) GetPath

func (m *Request) GetPath() string

func (*Request) GetQuery

func (m *Request) GetQuery() string

func (*Request) GetStart

func (m *Request) GetStart() int64

func (*Request) GetStep

func (m *Request) GetStep() int64

func (*Request) GetTimeout

func (m *Request) GetTimeout() time.Duration

func (*Request) GoString

func (this *Request) GoString() string

func (Request) LogToSpan

func (q Request) LogToSpan(ctx context.Context)

LogToSpan writes information about this request to the OpenTracing span in the context, if there is one.

func (*Request) Marshal

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

func (*Request) MarshalTo

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

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) Size

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

func (*Request) String

func (this *Request) String() string

func (*Request) Unmarshal

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

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

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

func (*Request) XXX_Merge

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

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

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

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) Descriptor() ([]byte, []int)

func (*Response) Equal

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

func (*Response) GetResult

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

func (*Response) GetResultType

func (m *Response) GetResultType() string

func (*Response) GoString

func (this *Response) GoString() string

func (*Response) Marshal

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

func (*Response) MarshalTo

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

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) Size

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

func (*Response) String

func (this *Response) String() string

func (*Response) Unmarshal

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

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

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

func (*Response) XXX_Merge

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

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

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

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) MarshalTo

func (m *SampleStream) MarshalTo(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 ToRoundTripperMiddleware

type ToRoundTripperMiddleware struct {
	Next http.RoundTripper
}

ToRoundTripperMiddleware not quite sure what this does.

func (ToRoundTripperMiddleware) Do

Do implements Handler.

Jump to

Keyboard shortcuts

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