Documentation
¶
Index ¶
- Constants
- Variables
- func FromResult(res *promql.Result) ([]tripperware.SampleStream, error)
- func Middlewares(cfg Config, log log.Logger, limits tripperware.Limits, ...) ([]tripperware.Middleware, cache.Cache, error)
- func NewLimitsMiddleware(l tripperware.Limits) tripperware.Middleware
- func NewResultsCacheMiddleware(logger log.Logger, cfg ResultsCacheConfig, splitter CacheSplitter, ...) (tripperware.Middleware, cache.Cache, error)
- func NewRetryMiddleware(log log.Logger, maxRetries int, metrics *RetryMiddlewareMetrics) tripperware.Middleware
- func NewSeriesSet(sortSeries bool, results []tripperware.SampleStream) storage.SeriesSet
- func ResponseToSamples(resp tripperware.Response) ([]tripperware.SampleStream, error)
- func SplitByIntervalMiddleware(interval IntervalFn, limits tripperware.Limits, merger tripperware.Merger, ...) tripperware.Middleware
- 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 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 IntervalFn
- type PrometheusData
- func (*PrometheusData) Descriptor() ([]byte, []int)
- func (this *PrometheusData) Equal(that interface{}) bool
- func (m *PrometheusData) GetResult() []tripperware.SampleStream
- func (m *PrometheusData) GetResultType() string
- func (m *PrometheusData) GetStats() *tripperware.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() []*tripperware.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) tripperware.Request
- func (q *PrometheusRequest) WithStartEnd(start int64, end int64) tripperware.Request
- func (q *PrometheusRequest) WithStats(stats string) tripperware.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 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() []*tripperware.PrometheusResponseHeader
- func (m *PrometheusResponse) GetStatus() string
- func (this *PrometheusResponse) GoString() string
- func (resp *PrometheusResponse) HTTPHeaders() map[string][]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
- func (PrometheusResponseExtractor) Extract(start, end int64, from tripperware.Response) tripperware.Response
- func (PrometheusResponseExtractor) ResponseWithoutHeaders(resp tripperware.Response) tripperware.Response
- func (PrometheusResponseExtractor) ResponseWithoutStats(resp tripperware.Response) tripperware.Response
- type ResultsCacheConfig
- type RetryMiddlewareMetrics
- type ShouldCacheFn
Constants ¶
const StatusSuccess = "success"
StatusSuccess Prometheus success result.
Variables ¶
var ( // PrometheusCodec is a codec to encode and decode Prometheus query range requests and responses. PrometheusCodec tripperware.Codec = &prometheusCodec{sharded: false} // ShardedPrometheusCodec is same as PrometheusCodec but to be used on the sharded queries (it sum up the stats) ShardedPrometheusCodec tripperware.Codec = &prometheusCodec{sharded: true} )
var ( ErrInvalidLengthQueryrange = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowQueryrange = fmt.Errorf("proto: integer overflow") )
var (
// ResultsCacheGenNumberHeaderName holds name of the header we want to set in http response
ResultsCacheGenNumberHeaderName = "Results-Cache-Gen-Number"
)
var StepAlignMiddleware = tripperware.MiddlewareFunc(func(next tripperware.Handler) tripperware.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 FromResult ¶
func FromResult(res *promql.Result) ([]tripperware.SampleStream, error)
FromResult transforms a promql query result into a samplestream
func Middlewares ¶
func Middlewares( cfg Config, log log.Logger, limits tripperware.Limits, cacheExtractor Extractor, registerer prometheus.Registerer, cacheGenNumberLoader CacheGenNumberLoader, ) ([]tripperware.Middleware, cache.Cache, error)
Middlewares returns list of middlewares that should be applied for range query.
func NewLimitsMiddleware ¶
func NewLimitsMiddleware(l tripperware.Limits) tripperware.Middleware
NewLimitsMiddleware creates a new Middleware that enforces query limits.
func NewResultsCacheMiddleware ¶
func NewResultsCacheMiddleware( logger log.Logger, cfg ResultsCacheConfig, splitter CacheSplitter, limits tripperware.Limits, merger tripperware.Merger, extractor Extractor, cacheGenNumberLoader CacheGenNumberLoader, shouldCache ShouldCacheFn, reg prometheus.Registerer, ) (tripperware.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) tripperware.Middleware
NewRetryMiddleware returns a middleware that retries requests if they fail with 500 or a non-HTTP error.
func NewSeriesSet ¶
func NewSeriesSet(sortSeries bool, results []tripperware.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 ResponseToSamples ¶
func ResponseToSamples(resp tripperware.Response) ([]tripperware.SampleStream, error)
ResponseToSamples is needed to map back from api response to the underlying series data
func SplitByIntervalMiddleware ¶
func SplitByIntervalMiddleware(interval IntervalFn, limits tripperware.Limits, merger tripperware.Merger, registerer prometheus.Registerer) tripperware.Middleware
SplitByIntervalMiddleware creates a new Middleware that splits requests by a given interval.
Types ¶
type CacheGenNumberLoader ¶
type CacheSplitter ¶
type CacheSplitter interface {
GenerateCacheKey(userID string, r tripperware.Request) string
}
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 ¶
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 ¶
type CachingOptions struct {
Disabled bool `protobuf:"varint,1,opt,name=disabled,proto3" json:"disabled,omitempty"`
}
func (*CachingOptions) Descriptor ¶
func (*CachingOptions) Descriptor() ([]byte, []int)
func (*CachingOptions) Equal ¶
func (this *CachingOptions) Equal(that interface{}) bool
func (*CachingOptions) GetDisabled ¶
func (m *CachingOptions) GetDisabled() bool
func (*CachingOptions) GoString ¶
func (this *CachingOptions) GoString() string
func (*CachingOptions) Marshal ¶
func (m *CachingOptions) Marshal() (dAtA []byte, err error)
func (*CachingOptions) MarshalToSizedBuffer ¶
func (m *CachingOptions) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CachingOptions) ProtoMessage ¶
func (*CachingOptions) ProtoMessage()
func (*CachingOptions) Reset ¶
func (m *CachingOptions) Reset()
func (*CachingOptions) Size ¶
func (m *CachingOptions) Size() (n int)
func (*CachingOptions) String ¶
func (this *CachingOptions) String() string
func (*CachingOptions) Unmarshal ¶
func (m *CachingOptions) Unmarshal(dAtA []byte) error
func (*CachingOptions) XXX_DiscardUnknown ¶
func (m *CachingOptions) XXX_DiscardUnknown()
func (*CachingOptions) XXX_Marshal ¶
func (m *CachingOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CachingOptions) XXX_Merge ¶
func (m *CachingOptions) XXX_Merge(src proto.Message)
func (*CachingOptions) XXX_Size ¶
func (m *CachingOptions) XXX_Size() int
func (*CachingOptions) XXX_Unmarshal ¶
func (m *CachingOptions) XXX_Unmarshal(b []byte) error
type Config ¶
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"` // List of headers which query_range middleware chain would forward to downstream querier. ForwardHeaders flagext.StringSlice `yaml:"forward_headers_list"` // Populated based on the query configuration VerticalShardSize int `yaml:"-"` }
Config for query_range middleware chain.
func (*Config) RegisterFlags ¶
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 ¶
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 ¶
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 tripperware.Response) tripperware.Response ResponseWithoutHeaders(resp tripperware.Response) tripperware.Response ResponseWithoutStats(resp tripperware.Response) tripperware.Response }
Extractor is used by the cache to extract a subset of a response from a cache entry.
type IntervalFn ¶
type IntervalFn func(r tripperware.Request) time.Duration
type PrometheusData ¶
type PrometheusData struct { ResultType string `protobuf:"bytes,1,opt,name=ResultType,proto3" json:"resultType"` Result []tripperware.SampleStream `protobuf:"bytes,2,rep,name=Result,proto3" json:"result"` Stats *tripperware.PrometheusResponseStats `protobuf:"bytes,3,opt,name=stats,proto3" json:"stats,omitempty"` }
func (*PrometheusData) Descriptor ¶
func (*PrometheusData) Descriptor() ([]byte, []int)
func (*PrometheusData) Equal ¶
func (this *PrometheusData) Equal(that interface{}) bool
func (*PrometheusData) GetResult ¶
func (m *PrometheusData) GetResult() []tripperware.SampleStream
func (*PrometheusData) GetResultType ¶
func (m *PrometheusData) GetResultType() string
func (*PrometheusData) GetStats ¶
func (m *PrometheusData) GetStats() *tripperware.PrometheusResponseStats
func (*PrometheusData) GoString ¶
func (this *PrometheusData) GoString() string
func (*PrometheusData) Marshal ¶
func (m *PrometheusData) Marshal() (dAtA []byte, err error)
func (*PrometheusData) MarshalToSizedBuffer ¶
func (m *PrometheusData) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusData) ProtoMessage ¶
func (*PrometheusData) ProtoMessage()
func (*PrometheusData) Reset ¶
func (m *PrometheusData) Reset()
func (*PrometheusData) Size ¶
func (m *PrometheusData) Size() (n int)
func (*PrometheusData) String ¶
func (this *PrometheusData) String() string
func (*PrometheusData) Unmarshal ¶
func (m *PrometheusData) Unmarshal(dAtA []byte) error
func (*PrometheusData) XXX_DiscardUnknown ¶
func (m *PrometheusData) XXX_DiscardUnknown()
func (*PrometheusData) XXX_Marshal ¶
func (m *PrometheusData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusData) XXX_Merge ¶
func (m *PrometheusData) XXX_Merge(src proto.Message)
func (*PrometheusData) XXX_Size ¶
func (m *PrometheusData) XXX_Size() int
func (*PrometheusData) XXX_Unmarshal ¶
func (m *PrometheusData) XXX_Unmarshal(b []byte) error
type PrometheusRequest ¶
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 []*tripperware.PrometheusRequestHeader `protobuf:"bytes,8,rep,name=Headers,proto3" json:"-"` Stats string `protobuf:"bytes,9,opt,name=stats,proto3" json:"stats,omitempty"` }
func (*PrometheusRequest) Descriptor ¶
func (*PrometheusRequest) Descriptor() ([]byte, []int)
func (*PrometheusRequest) Equal ¶
func (this *PrometheusRequest) Equal(that interface{}) bool
func (*PrometheusRequest) GetCachingOptions ¶
func (m *PrometheusRequest) GetCachingOptions() CachingOptions
func (*PrometheusRequest) GetEnd ¶
func (m *PrometheusRequest) GetEnd() int64
func (*PrometheusRequest) GetHeaders ¶
func (m *PrometheusRequest) GetHeaders() []*tripperware.PrometheusRequestHeader
func (*PrometheusRequest) GetPath ¶
func (m *PrometheusRequest) GetPath() string
func (*PrometheusRequest) GetQuery ¶
func (m *PrometheusRequest) GetQuery() string
func (*PrometheusRequest) GetStart ¶
func (m *PrometheusRequest) GetStart() int64
func (*PrometheusRequest) GetStats ¶
func (m *PrometheusRequest) GetStats() string
func (*PrometheusRequest) GetStep ¶
func (m *PrometheusRequest) GetStep() int64
func (*PrometheusRequest) GetTimeout ¶
func (m *PrometheusRequest) GetTimeout() time.Duration
func (*PrometheusRequest) GoString ¶
func (this *PrometheusRequest) GoString() string
func (*PrometheusRequest) LogToSpan ¶
func (q *PrometheusRequest) LogToSpan(sp opentracing.Span)
LogToSpan logs the current `PrometheusRequest` parameters to the specified span.
func (*PrometheusRequest) Marshal ¶
func (m *PrometheusRequest) Marshal() (dAtA []byte, err error)
func (*PrometheusRequest) MarshalTo ¶
func (m *PrometheusRequest) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusRequest) MarshalToSizedBuffer ¶
func (m *PrometheusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusRequest) ProtoMessage ¶
func (*PrometheusRequest) ProtoMessage()
func (*PrometheusRequest) Reset ¶
func (m *PrometheusRequest) Reset()
func (*PrometheusRequest) Size ¶
func (m *PrometheusRequest) Size() (n int)
func (*PrometheusRequest) String ¶
func (this *PrometheusRequest) String() string
func (*PrometheusRequest) Unmarshal ¶
func (m *PrometheusRequest) Unmarshal(dAtA []byte) error
func (*PrometheusRequest) WithQuery ¶
func (q *PrometheusRequest) WithQuery(query string) tripperware.Request
WithQuery clones the current `PrometheusRequest` with a new query.
func (*PrometheusRequest) WithStartEnd ¶
func (q *PrometheusRequest) WithStartEnd(start int64, end int64) tripperware.Request
WithStartEnd clones the current `PrometheusRequest` with a new `start` and `end` timestamp.
func (*PrometheusRequest) WithStats ¶
func (q *PrometheusRequest) WithStats(stats string) tripperware.Request
WithStats clones the current `PrometheusRequest` with a new stats.
func (*PrometheusRequest) XXX_DiscardUnknown ¶
func (m *PrometheusRequest) XXX_DiscardUnknown()
func (*PrometheusRequest) XXX_Marshal ¶
func (m *PrometheusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusRequest) XXX_Merge ¶
func (m *PrometheusRequest) XXX_Merge(src proto.Message)
func (*PrometheusRequest) XXX_Size ¶
func (m *PrometheusRequest) XXX_Size() int
func (*PrometheusRequest) XXX_Unmarshal ¶
func (m *PrometheusRequest) XXX_Unmarshal(b []byte) error
type PrometheusResponse ¶
type PrometheusResponse struct { Status string `protobuf:"bytes,1,opt,name=Status,proto3" json:"status"` Data PrometheusData `protobuf:"bytes,2,opt,name=Data,proto3" json:"data,omitempty"` ErrorType string `protobuf:"bytes,3,opt,name=ErrorType,proto3" json:"errorType,omitempty"` Error string `protobuf:"bytes,4,opt,name=Error,proto3" json:"error,omitempty"` Headers []*tripperware.PrometheusResponseHeader `protobuf:"bytes,5,rep,name=Headers,proto3" json:"-"` }
func NewEmptyPrometheusResponse ¶
func NewEmptyPrometheusResponse() *PrometheusResponse
NewEmptyPrometheusResponse returns an empty successful Prometheus query range response.
func (*PrometheusResponse) Descriptor ¶
func (*PrometheusResponse) Descriptor() ([]byte, []int)
func (*PrometheusResponse) Equal ¶
func (this *PrometheusResponse) Equal(that interface{}) bool
func (*PrometheusResponse) GetData ¶
func (m *PrometheusResponse) GetData() PrometheusData
func (*PrometheusResponse) GetError ¶
func (m *PrometheusResponse) GetError() string
func (*PrometheusResponse) GetErrorType ¶
func (m *PrometheusResponse) GetErrorType() string
func (*PrometheusResponse) GetHeaders ¶
func (m *PrometheusResponse) GetHeaders() []*tripperware.PrometheusResponseHeader
func (*PrometheusResponse) GetStatus ¶
func (m *PrometheusResponse) GetStatus() string
func (*PrometheusResponse) GoString ¶
func (this *PrometheusResponse) GoString() string
func (*PrometheusResponse) HTTPHeaders ¶
func (resp *PrometheusResponse) HTTPHeaders() map[string][]string
func (*PrometheusResponse) Marshal ¶
func (m *PrometheusResponse) Marshal() (dAtA []byte, err error)
func (*PrometheusResponse) MarshalTo ¶
func (m *PrometheusResponse) MarshalTo(dAtA []byte) (int, error)
func (*PrometheusResponse) MarshalToSizedBuffer ¶
func (m *PrometheusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PrometheusResponse) ProtoMessage ¶
func (*PrometheusResponse) ProtoMessage()
func (*PrometheusResponse) Reset ¶
func (m *PrometheusResponse) Reset()
func (*PrometheusResponse) Size ¶
func (m *PrometheusResponse) Size() (n int)
func (*PrometheusResponse) String ¶
func (this *PrometheusResponse) String() string
func (*PrometheusResponse) Unmarshal ¶
func (m *PrometheusResponse) Unmarshal(dAtA []byte) error
func (*PrometheusResponse) XXX_DiscardUnknown ¶
func (m *PrometheusResponse) XXX_DiscardUnknown()
func (*PrometheusResponse) XXX_Marshal ¶
func (m *PrometheusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PrometheusResponse) XXX_Merge ¶
func (m *PrometheusResponse) XXX_Merge(src proto.Message)
func (*PrometheusResponse) XXX_Size ¶
func (m *PrometheusResponse) XXX_Size() int
func (*PrometheusResponse) XXX_Unmarshal ¶
func (m *PrometheusResponse) XXX_Unmarshal(b []byte) error
type PrometheusResponseExtractor ¶
type PrometheusResponseExtractor struct{}
PrometheusResponseExtractor helps extracting specific info from Query Response.
func (PrometheusResponseExtractor) Extract ¶
func (PrometheusResponseExtractor) Extract(start, end int64, from tripperware.Response) tripperware.Response
Extract extracts response for specific a range from a response.
func (PrometheusResponseExtractor) ResponseWithoutHeaders ¶
func (PrometheusResponseExtractor) ResponseWithoutHeaders(resp tripperware.Response) tripperware.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 ¶
func (PrometheusResponseExtractor) ResponseWithoutStats(resp tripperware.Response) tripperware.Response
ResponseWithoutStats is returns the response without the stats information
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 ¶
type RetryMiddlewareMetrics struct {
// contains filtered or unexported fields
}
func NewRetryMiddlewareMetrics ¶
func NewRetryMiddlewareMetrics(registerer prometheus.Registerer) *RetryMiddlewareMetrics
type ShouldCacheFn ¶
type ShouldCacheFn func(r tripperware.Request) bool
ShouldCacheFn checks whether the current request should go to cache or not. If not, just send the request to next handler.