queryrange

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: AGPL-3.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstantQueryOp = "instant_query"
	QueryRangeOp   = "query_range"
	SeriesOp       = "series"
	LabelNamesOp   = "labels"
)
View Source
const (
	DefaultDownstreamConcurrency = 128
)

Variables

View Source
var (
	ErrInvalidLengthQueryrange = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQueryrange   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrMaxQueryParalellism = fmt.Errorf("querying is disabled, please contact your Loki operator")
)
View Source
var LokiCodec = &Codec{}
View Source
var (

	// StatsHTTPMiddleware is an http middleware to record stats for query_range filter.
	StatsHTTPMiddleware = statsHTTPMiddleware(defaultMetricRecorder)
)

Functions

func NewInstantMetricTripperware

func NewInstantMetricTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	schema chunk.SchemaConfig,
	codec queryrangebase.Codec,
	metrics *Metrics,
) (queryrangebase.Tripperware, error)

NewInstantMetricTripperware creates a new frontend tripperware responsible for handling metric queries

func NewLabelsTripperware

func NewLabelsTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	codec queryrangebase.Codec,
	metrics *Metrics,
) (queryrangebase.Tripperware, error)

NewLabelsTripperware creates a new frontend tripperware responsible for handling labels requests.

func NewLimitedRoundTripper

func NewLimitedRoundTripper(next http.RoundTripper, codec queryrangebase.Codec, limits Limits, middlewares ...queryrangebase.Middleware) http.RoundTripper

NewLimitedRoundTripper creates a new roundtripper that enforces MaxQueryParallelism to the `next` roundtripper across `middlewares`.

func NewLimitsMiddleware

func NewLimitsMiddleware(l Limits) queryrangebase.Middleware

NewLimitsMiddleware creates a new Middleware that enforces query limits.

func NewLogFilterTripperware

func NewLogFilterTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	schema chunk.SchemaConfig,
	codec queryrangebase.Codec,
	c cache.Cache,
	metrics *Metrics,
) (queryrangebase.Tripperware, error)

NewLogFilterTripperware creates a new frontend tripperware responsible for handling log requests with regex.

func NewLogResultCache

func NewLogResultCache(logger log.Logger, limits Limits, cache cache.Cache, shouldCache queryrangebase.ShouldCacheFn, metrics *LogResultCacheMetrics) queryrangebase.Middleware

NewLogResultCache creates a new log result cache middleware. Currently it only caches empty filter queries, this is because those are usually easily and freely cacheable. Log hits are difficult to handle because of the limit query parameter and the size of the response. In the future it could be extended to cache non-empty query results. see https://docs.google.com/document/d/1_mACOpxdWZ5K0cIedaja5gzMbv-m0lUVazqZd2O4mEU/edit

func NewMetricTripperware

func NewMetricTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	schema chunk.SchemaConfig,
	codec queryrangebase.Codec,
	c cache.Cache,
	extractor queryrangebase.Extractor,
	metrics *Metrics,
	registerer prometheus.Registerer,
) (queryrangebase.Tripperware, error)

NewMetricTripperware creates a new frontend tripperware responsible for handling metric queries

func NewQueryShardMiddleware

func NewQueryShardMiddleware(
	logger log.Logger,
	confs ShardingConfigs,
	middlewareMetrics *queryrangebase.InstrumentMiddlewareMetrics,
	shardingMetrics *logql.ShardingMetrics,
	limits Limits,
) queryrangebase.Middleware

NewQueryShardMiddleware creates a middleware which downstreams queries after AST mapping and query encoding.

func NewSeriesQueryShardMiddleware

func NewSeriesQueryShardMiddleware(
	logger log.Logger,
	confs ShardingConfigs,
	middlewareMetrics *queryrangebase.InstrumentMiddlewareMetrics,
	shardingMetrics *logql.ShardingMetrics,
	limits queryrangebase.Limits,
	merger queryrangebase.Merger,
) queryrangebase.Middleware

NewSeriesQueryShardMiddleware creates a middleware which shards series queries.

func NewSeriesTripperware

func NewSeriesTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	codec queryrangebase.Codec,
	metrics *Metrics,
	schema chunk.SchemaConfig,
) (queryrangebase.Tripperware, error)

NewSeriesTripperware creates a new frontend tripperware responsible for handling series requests

func ParamsToLokiRequest

func ParamsToLokiRequest(params logql.Params, shards logql.Shards) queryrangebase.Request

func ResponseToResult

func ResponseToResult(resp queryrangebase.Response) (logqlmodel.Result, error)

func SplitByIntervalMiddleware

func SplitByIntervalMiddleware(limits Limits, merger queryrangebase.Merger, splitter Splitter, metrics *SplitByMetrics) queryrangebase.Middleware

SplitByIntervalMiddleware creates a new Middleware that splits log requests by a given interval.

func StatsCollectorMiddleware

func StatsCollectorMiddleware() queryrangebase.Middleware

StatsCollectorMiddleware compute the stats summary based on the actual duration of the request and inject it in the request context.

Types

type Buffer

type Buffer interface {
	Bytes() []byte
}

type Codec

type Codec struct{}

func (Codec) DecodeRequest

func (Codec) DecodeRequest(_ context.Context, r *http.Request, forwardHeaders []string) (queryrangebase.Request, error)

func (Codec) DecodeResponse

func (Codec) EncodeRequest

func (Codec) EncodeRequest(ctx context.Context, r queryrangebase.Request) (*http.Request, error)

func (Codec) EncodeResponse

func (Codec) EncodeResponse(ctx context.Context, res queryrangebase.Response) (*http.Response, error)

func (Codec) MergeResponse

func (Codec) MergeResponse(responses ...queryrangebase.Response) (queryrangebase.Response, error)

NOTE: When we would start caching response from non-metric queries we would have to consider cache gen headers as well in MergeResponse implementation for Loki codecs same as it is done in Cortex at https://github.com/cortexproject/cortex/blob/21bad57b346c730d684d6d0205efef133422ab28/pkg/querier/queryrange/query_range.go#L170

type Config

type Config struct {
	queryrangebase.Config `yaml:",inline"`
}

Config is the configuration for the queryrange tripperware

func (*Config) RegisterFlags

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

RegisterFlags adds the flags required to configure this flag set.

type DownstreamHandler

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

func (DownstreamHandler) Downstreamer

func (h DownstreamHandler) Downstreamer() logql.Downstreamer

Note: After the introduction of the LimitedRoundTripper, bounding concurrency in the downstreamer is mostly redundant The reason we don't remove it is to prevent malicious queries from creating an unreasonably large number of goroutines, such as the case of a query like `a / a / a / a / a ..etc`, which could try to shard each leg, quickly dispatching an unreasonable number of goroutines.

type Limits

type Limits interface {
	queryrangebase.Limits
	logql.Limits
	QuerySplitDuration(string) time.Duration
	MaxQuerySeries(string) int
	MaxEntriesLimitPerQuery(string) int
	MinShardingLookback(string) time.Duration
}

Limits extends the cortex limits interface with support for per tenant splitby parameters

func WithSplitByLimits

func WithSplitByLimits(l Limits, splitBy time.Duration) Limits

WithSplitByLimits will construct a Limits with a static split by duration.

type LogResultCacheMetrics

type LogResultCacheMetrics struct {
	CacheHit  prometheus.Counter
	CacheMiss prometheus.Counter
}

LogResultCacheMetrics is the metrics wrapper used in log result cache.

func NewLogResultCacheMetrics

func NewLogResultCacheMetrics(registerer prometheus.Registerer) *LogResultCacheMetrics

NewLogResultCacheMetrics creates metrics to be used in log result cache.

type LokiData

type LokiData struct {
	ResultType string                                        `protobuf:"bytes,1,opt,name=ResultType,proto3" json:"resultType"`
	Result     []github_com_grafana_loki_pkg_logproto.Stream `protobuf:"bytes,2,rep,name=Result,proto3,customtype=github.com/pao214/loki/v2/pkg/logproto.Stream" json:"result"`
}

func (*LokiData) Descriptor

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

func (*LokiData) Equal

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

func (*LokiData) GetResultType

func (m *LokiData) GetResultType() string

func (*LokiData) GoString

func (this *LokiData) GoString() string

func (*LokiData) Marshal

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

func (*LokiData) MarshalTo

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

func (*LokiData) MarshalToSizedBuffer

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

func (*LokiData) ProtoMessage

func (*LokiData) ProtoMessage()

func (*LokiData) Reset

func (m *LokiData) Reset()

func (*LokiData) Size

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

func (*LokiData) String

func (this *LokiData) String() string

func (*LokiData) Unmarshal

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

func (*LokiData) XXX_DiscardUnknown

func (m *LokiData) XXX_DiscardUnknown()

func (*LokiData) XXX_Marshal

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

func (*LokiData) XXX_Merge

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

func (*LokiData) XXX_Size

func (m *LokiData) XXX_Size() int

func (*LokiData) XXX_Unmarshal

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

type LokiInstantRequest

type LokiInstantRequest struct {
	Query     string             `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	Limit     uint32             `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	TimeTs    time.Time          `protobuf:"bytes,3,opt,name=timeTs,proto3,stdtime" json:"timeTs"`
	Direction logproto.Direction `protobuf:"varint,4,opt,name=direction,proto3,enum=logproto.Direction" json:"direction,omitempty"`
	Path      string             `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"`
	Shards    []string           `protobuf:"bytes,6,rep,name=shards,proto3" json:"shards"`
}

func (*LokiInstantRequest) Descriptor

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

func (*LokiInstantRequest) Equal

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

func (*LokiInstantRequest) GetCachingOptions

func (*LokiInstantRequest) GetCachingOptions() (res queryrangebase.CachingOptions)

func (*LokiInstantRequest) GetDirection

func (m *LokiInstantRequest) GetDirection() logproto.Direction

func (*LokiInstantRequest) GetEnd

func (r *LokiInstantRequest) GetEnd() int64

func (*LokiInstantRequest) GetLimit

func (m *LokiInstantRequest) GetLimit() uint32

func (*LokiInstantRequest) GetPath

func (m *LokiInstantRequest) GetPath() string

func (*LokiInstantRequest) GetQuery

func (m *LokiInstantRequest) GetQuery() string

func (*LokiInstantRequest) GetShards

func (m *LokiInstantRequest) GetShards() []string

func (*LokiInstantRequest) GetStart

func (r *LokiInstantRequest) GetStart() int64

func (*LokiInstantRequest) GetStep

func (r *LokiInstantRequest) GetStep() int64

func (*LokiInstantRequest) GetTimeTs

func (m *LokiInstantRequest) GetTimeTs() time.Time

func (*LokiInstantRequest) GoString

func (this *LokiInstantRequest) GoString() string

func (*LokiInstantRequest) LogToSpan

func (r *LokiInstantRequest) LogToSpan(sp opentracing.Span)

func (*LokiInstantRequest) Marshal

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

func (*LokiInstantRequest) MarshalTo

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

func (*LokiInstantRequest) MarshalToSizedBuffer

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

func (*LokiInstantRequest) ProtoMessage

func (*LokiInstantRequest) ProtoMessage()

func (*LokiInstantRequest) Reset

func (m *LokiInstantRequest) Reset()

func (*LokiInstantRequest) Size

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

func (*LokiInstantRequest) String

func (this *LokiInstantRequest) String() string

func (*LokiInstantRequest) Unmarshal

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

func (*LokiInstantRequest) WithQuery

func (r *LokiInstantRequest) WithQuery(query string) queryrangebase.Request

func (*LokiInstantRequest) WithShards

func (r *LokiInstantRequest) WithShards(shards logql.Shards) *LokiInstantRequest

func (*LokiInstantRequest) WithStartEnd

func (r *LokiInstantRequest) WithStartEnd(s int64, e int64) queryrangebase.Request

func (*LokiInstantRequest) XXX_DiscardUnknown

func (m *LokiInstantRequest) XXX_DiscardUnknown()

func (*LokiInstantRequest) XXX_Marshal

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

func (*LokiInstantRequest) XXX_Merge

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

func (*LokiInstantRequest) XXX_Size

func (m *LokiInstantRequest) XXX_Size() int

func (*LokiInstantRequest) XXX_Unmarshal

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

type LokiLabelNamesRequest

type LokiLabelNamesRequest struct {
	StartTs time.Time `protobuf:"bytes,1,opt,name=startTs,proto3,stdtime" json:"startTs"`
	EndTs   time.Time `protobuf:"bytes,2,opt,name=endTs,proto3,stdtime" json:"endTs"`
	Path    string    `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
}

func (*LokiLabelNamesRequest) Descriptor

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

func (*LokiLabelNamesRequest) Equal

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

func (*LokiLabelNamesRequest) GetCachingOptions

func (*LokiLabelNamesRequest) GetCachingOptions() (res queryrangebase.CachingOptions)

func (*LokiLabelNamesRequest) GetEnd

func (r *LokiLabelNamesRequest) GetEnd() int64

func (*LokiLabelNamesRequest) GetEndTs

func (m *LokiLabelNamesRequest) GetEndTs() time.Time

func (*LokiLabelNamesRequest) GetPath

func (m *LokiLabelNamesRequest) GetPath() string

func (*LokiLabelNamesRequest) GetQuery

func (r *LokiLabelNamesRequest) GetQuery() string

func (*LokiLabelNamesRequest) GetStart

func (r *LokiLabelNamesRequest) GetStart() int64

func (*LokiLabelNamesRequest) GetStartTs

func (m *LokiLabelNamesRequest) GetStartTs() time.Time

func (*LokiLabelNamesRequest) GetStep

func (r *LokiLabelNamesRequest) GetStep() int64

func (*LokiLabelNamesRequest) GoString

func (this *LokiLabelNamesRequest) GoString() string

func (*LokiLabelNamesRequest) LogToSpan

func (r *LokiLabelNamesRequest) LogToSpan(sp opentracing.Span)

func (*LokiLabelNamesRequest) Marshal

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

func (*LokiLabelNamesRequest) MarshalTo

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

func (*LokiLabelNamesRequest) MarshalToSizedBuffer

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

func (*LokiLabelNamesRequest) ProtoMessage

func (*LokiLabelNamesRequest) ProtoMessage()

func (*LokiLabelNamesRequest) Reset

func (m *LokiLabelNamesRequest) Reset()

func (*LokiLabelNamesRequest) Size

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

func (*LokiLabelNamesRequest) String

func (this *LokiLabelNamesRequest) String() string

func (*LokiLabelNamesRequest) Unmarshal

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

func (*LokiLabelNamesRequest) WithQuery

func (r *LokiLabelNamesRequest) WithQuery(query string) queryrangebase.Request

func (*LokiLabelNamesRequest) WithStartEnd

func (r *LokiLabelNamesRequest) WithStartEnd(s int64, e int64) queryrangebase.Request

func (*LokiLabelNamesRequest) XXX_DiscardUnknown

func (m *LokiLabelNamesRequest) XXX_DiscardUnknown()

func (*LokiLabelNamesRequest) XXX_Marshal

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

func (*LokiLabelNamesRequest) XXX_Merge

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

func (*LokiLabelNamesRequest) XXX_Size

func (m *LokiLabelNamesRequest) XXX_Size() int

func (*LokiLabelNamesRequest) XXX_Unmarshal

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

type LokiLabelNamesResponse

type LokiLabelNamesResponse struct {
	Status  string                                                                                   `protobuf:"bytes,1,opt,name=Status,proto3" json:"status"`
	Data    []string                                                                                 `protobuf:"bytes,2,rep,name=Data,proto3" json:"data,omitempty"`
	Version uint32                                                                                   `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
	Headers []github_com_grafana_loki_pkg_querier_queryrange_queryrangebase.PrometheusResponseHeader `` /* 151-byte string literal not displayed */
}

func (*LokiLabelNamesResponse) Descriptor

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

func (*LokiLabelNamesResponse) Equal

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

func (*LokiLabelNamesResponse) GetData

func (m *LokiLabelNamesResponse) GetData() []string

func (*LokiLabelNamesResponse) GetHeaders

func (*LokiLabelNamesResponse) GetStatus

func (m *LokiLabelNamesResponse) GetStatus() string

func (*LokiLabelNamesResponse) GetVersion

func (m *LokiLabelNamesResponse) GetVersion() uint32

func (*LokiLabelNamesResponse) GoString

func (this *LokiLabelNamesResponse) GoString() string

func (*LokiLabelNamesResponse) Marshal

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

func (*LokiLabelNamesResponse) MarshalTo

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

func (*LokiLabelNamesResponse) MarshalToSizedBuffer

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

func (*LokiLabelNamesResponse) ProtoMessage

func (*LokiLabelNamesResponse) ProtoMessage()

func (*LokiLabelNamesResponse) Reset

func (m *LokiLabelNamesResponse) Reset()

func (*LokiLabelNamesResponse) Size

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

func (*LokiLabelNamesResponse) String

func (this *LokiLabelNamesResponse) String() string

func (*LokiLabelNamesResponse) Unmarshal

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

func (*LokiLabelNamesResponse) XXX_DiscardUnknown

func (m *LokiLabelNamesResponse) XXX_DiscardUnknown()

func (*LokiLabelNamesResponse) XXX_Marshal

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

func (*LokiLabelNamesResponse) XXX_Merge

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

func (*LokiLabelNamesResponse) XXX_Size

func (m *LokiLabelNamesResponse) XXX_Size() int

func (*LokiLabelNamesResponse) XXX_Unmarshal

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

type LokiPromResponse

type LokiPromResponse struct {
	Response   *queryrangebase.PrometheusResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
	Statistics stats.Result                       `protobuf:"bytes,2,opt,name=statistics,proto3" json:"statistics"`
}

LokiPromResponse wraps a Prometheus response with statistics.

func (*LokiPromResponse) Descriptor

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

func (*LokiPromResponse) Equal

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

func (*LokiPromResponse) GetHeaders

func (*LokiPromResponse) GetResponse

func (*LokiPromResponse) GetStatistics

func (m *LokiPromResponse) GetStatistics() stats.Result

func (*LokiPromResponse) GoString

func (this *LokiPromResponse) GoString() string

func (*LokiPromResponse) Marshal

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

func (*LokiPromResponse) MarshalTo

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

func (*LokiPromResponse) MarshalToSizedBuffer

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

func (*LokiPromResponse) ProtoMessage

func (*LokiPromResponse) ProtoMessage()

func (*LokiPromResponse) Reset

func (m *LokiPromResponse) Reset()

func (*LokiPromResponse) Size

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

func (*LokiPromResponse) String

func (this *LokiPromResponse) String() string

func (*LokiPromResponse) Unmarshal

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

func (*LokiPromResponse) XXX_DiscardUnknown

func (m *LokiPromResponse) XXX_DiscardUnknown()

func (*LokiPromResponse) XXX_Marshal

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

func (*LokiPromResponse) XXX_Merge

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

func (*LokiPromResponse) XXX_Size

func (m *LokiPromResponse) XXX_Size() int

func (*LokiPromResponse) XXX_Unmarshal

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

type LokiRequest

type LokiRequest struct {
	Query     string             `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	Limit     uint32             `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	Step      int64              `protobuf:"varint,3,opt,name=step,proto3" json:"step,omitempty"`
	Interval  int64              `protobuf:"varint,9,opt,name=interval,proto3" json:"interval,omitempty"`
	StartTs   time.Time          `protobuf:"bytes,4,opt,name=startTs,proto3,stdtime" json:"startTs"`
	EndTs     time.Time          `protobuf:"bytes,5,opt,name=endTs,proto3,stdtime" json:"endTs"`
	Direction logproto.Direction `protobuf:"varint,6,opt,name=direction,proto3,enum=logproto.Direction" json:"direction,omitempty"`
	Path      string             `protobuf:"bytes,7,opt,name=path,proto3" json:"path,omitempty"`
	Shards    []string           `protobuf:"bytes,8,rep,name=shards,proto3" json:"shards"`
}

func (*LokiRequest) Descriptor

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

func (*LokiRequest) Equal

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

func (*LokiRequest) GetCachingOptions

func (*LokiRequest) GetCachingOptions() (res queryrangebase.CachingOptions)

func (*LokiRequest) GetDirection

func (m *LokiRequest) GetDirection() logproto.Direction

func (*LokiRequest) GetEnd

func (r *LokiRequest) GetEnd() int64

func (*LokiRequest) GetEndTs

func (m *LokiRequest) GetEndTs() time.Time

func (*LokiRequest) GetInterval

func (m *LokiRequest) GetInterval() int64

func (*LokiRequest) GetLimit

func (m *LokiRequest) GetLimit() uint32

func (*LokiRequest) GetPath

func (m *LokiRequest) GetPath() string

func (*LokiRequest) GetQuery

func (m *LokiRequest) GetQuery() string

func (*LokiRequest) GetShards

func (m *LokiRequest) GetShards() []string

func (*LokiRequest) GetStart

func (r *LokiRequest) GetStart() int64

func (*LokiRequest) GetStartTs

func (m *LokiRequest) GetStartTs() time.Time

func (*LokiRequest) GetStep

func (m *LokiRequest) GetStep() int64

func (*LokiRequest) GoString

func (this *LokiRequest) GoString() string

func (*LokiRequest) LogToSpan

func (r *LokiRequest) LogToSpan(sp opentracing.Span)

func (*LokiRequest) Marshal

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

func (*LokiRequest) MarshalTo

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

func (*LokiRequest) MarshalToSizedBuffer

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

func (*LokiRequest) ProtoMessage

func (*LokiRequest) ProtoMessage()

func (*LokiRequest) Reset

func (m *LokiRequest) Reset()

func (*LokiRequest) Size

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

func (*LokiRequest) String

func (this *LokiRequest) String() string

func (*LokiRequest) Unmarshal

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

func (*LokiRequest) WithQuery

func (r *LokiRequest) WithQuery(query string) queryrangebase.Request

func (*LokiRequest) WithShards

func (r *LokiRequest) WithShards(shards logql.Shards) *LokiRequest

func (*LokiRequest) WithStartEnd

func (r *LokiRequest) WithStartEnd(s int64, e int64) queryrangebase.Request

func (*LokiRequest) WithStartEndTime

func (r *LokiRequest) WithStartEndTime(s time.Time, e time.Time) *LokiRequest

func (*LokiRequest) XXX_DiscardUnknown

func (m *LokiRequest) XXX_DiscardUnknown()

func (*LokiRequest) XXX_Marshal

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

func (*LokiRequest) XXX_Merge

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

func (*LokiRequest) XXX_Size

func (m *LokiRequest) XXX_Size() int

func (*LokiRequest) XXX_Unmarshal

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

type LokiResponse

type LokiResponse struct {
	Status     string                                                                                   `protobuf:"bytes,1,opt,name=Status,proto3" json:"status"`
	Data       LokiData                                                                                 `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"`
	Direction  logproto.Direction                                                                       `protobuf:"varint,5,opt,name=direction,proto3,enum=logproto.Direction" json:"direction,omitempty"`
	Limit      uint32                                                                                   `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"`
	Version    uint32                                                                                   `protobuf:"varint,7,opt,name=version,proto3" json:"version,omitempty"`
	Statistics stats.Result                                                                             `protobuf:"bytes,8,opt,name=statistics,proto3" json:"statistics"`
	Headers    []github_com_grafana_loki_pkg_querier_queryrange_queryrangebase.PrometheusResponseHeader `` /* 151-byte string literal not displayed */
}

func (LokiResponse) Count

func (res LokiResponse) Count() int64

func (*LokiResponse) Descriptor

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

func (*LokiResponse) Equal

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

func (*LokiResponse) GetData

func (m *LokiResponse) GetData() LokiData

func (*LokiResponse) GetDirection

func (m *LokiResponse) GetDirection() logproto.Direction

func (*LokiResponse) GetError

func (m *LokiResponse) GetError() string

func (*LokiResponse) GetErrorType

func (m *LokiResponse) GetErrorType() string

func (*LokiResponse) GetHeaders

func (*LokiResponse) GetLimit

func (m *LokiResponse) GetLimit() uint32

func (*LokiResponse) GetStatistics

func (m *LokiResponse) GetStatistics() stats.Result

func (*LokiResponse) GetStatus

func (m *LokiResponse) GetStatus() string

func (*LokiResponse) GetVersion

func (m *LokiResponse) GetVersion() uint32

func (*LokiResponse) GoString

func (this *LokiResponse) GoString() string

func (*LokiResponse) Marshal

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

func (*LokiResponse) MarshalTo

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

func (*LokiResponse) MarshalToSizedBuffer

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

func (*LokiResponse) ProtoMessage

func (*LokiResponse) ProtoMessage()

func (*LokiResponse) Reset

func (m *LokiResponse) Reset()

func (*LokiResponse) Size

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

func (*LokiResponse) String

func (this *LokiResponse) String() string

func (*LokiResponse) Unmarshal

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

func (*LokiResponse) XXX_DiscardUnknown

func (m *LokiResponse) XXX_DiscardUnknown()

func (*LokiResponse) XXX_Marshal

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

func (*LokiResponse) XXX_Merge

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

func (*LokiResponse) XXX_Size

func (m *LokiResponse) XXX_Size() int

func (*LokiResponse) XXX_Unmarshal

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

type LokiSeriesRequest

type LokiSeriesRequest struct {
	Match   []string  `protobuf:"bytes,1,rep,name=match,proto3" json:"match,omitempty"`
	StartTs time.Time `protobuf:"bytes,2,opt,name=startTs,proto3,stdtime" json:"startTs"`
	EndTs   time.Time `protobuf:"bytes,3,opt,name=endTs,proto3,stdtime" json:"endTs"`
	Path    string    `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"`
	Shards  []string  `protobuf:"bytes,5,rep,name=shards,proto3" json:"shards"`
}

func (*LokiSeriesRequest) Descriptor

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

func (*LokiSeriesRequest) Equal

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

func (*LokiSeriesRequest) GetCachingOptions

func (*LokiSeriesRequest) GetCachingOptions() (res queryrangebase.CachingOptions)

func (*LokiSeriesRequest) GetEnd

func (r *LokiSeriesRequest) GetEnd() int64

func (*LokiSeriesRequest) GetEndTs

func (m *LokiSeriesRequest) GetEndTs() time.Time

func (*LokiSeriesRequest) GetMatch

func (m *LokiSeriesRequest) GetMatch() []string

func (*LokiSeriesRequest) GetPath

func (m *LokiSeriesRequest) GetPath() string

func (*LokiSeriesRequest) GetQuery

func (r *LokiSeriesRequest) GetQuery() string

func (*LokiSeriesRequest) GetShards

func (m *LokiSeriesRequest) GetShards() []string

func (*LokiSeriesRequest) GetStart

func (r *LokiSeriesRequest) GetStart() int64

func (*LokiSeriesRequest) GetStartTs

func (m *LokiSeriesRequest) GetStartTs() time.Time

func (*LokiSeriesRequest) GetStep

func (r *LokiSeriesRequest) GetStep() int64

func (*LokiSeriesRequest) GoString

func (this *LokiSeriesRequest) GoString() string

func (*LokiSeriesRequest) LogToSpan

func (r *LokiSeriesRequest) LogToSpan(sp opentracing.Span)

func (*LokiSeriesRequest) Marshal

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

func (*LokiSeriesRequest) MarshalTo

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

func (*LokiSeriesRequest) MarshalToSizedBuffer

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

func (*LokiSeriesRequest) ProtoMessage

func (*LokiSeriesRequest) ProtoMessage()

func (*LokiSeriesRequest) Reset

func (m *LokiSeriesRequest) Reset()

func (*LokiSeriesRequest) Size

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

func (*LokiSeriesRequest) String

func (this *LokiSeriesRequest) String() string

func (*LokiSeriesRequest) Unmarshal

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

func (*LokiSeriesRequest) WithQuery

func (r *LokiSeriesRequest) WithQuery(query string) queryrangebase.Request

func (*LokiSeriesRequest) WithStartEnd

func (r *LokiSeriesRequest) WithStartEnd(s int64, e int64) queryrangebase.Request

func (*LokiSeriesRequest) XXX_DiscardUnknown

func (m *LokiSeriesRequest) XXX_DiscardUnknown()

func (*LokiSeriesRequest) XXX_Marshal

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

func (*LokiSeriesRequest) XXX_Merge

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

func (*LokiSeriesRequest) XXX_Size

func (m *LokiSeriesRequest) XXX_Size() int

func (*LokiSeriesRequest) XXX_Unmarshal

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

type LokiSeriesResponse

type LokiSeriesResponse struct {
	Status  string                                                                                   `protobuf:"bytes,1,opt,name=Status,proto3" json:"status"`
	Data    []logproto.SeriesIdentifier                                                              `protobuf:"bytes,2,rep,name=Data,proto3" json:"data,omitempty"`
	Version uint32                                                                                   `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
	Headers []github_com_grafana_loki_pkg_querier_queryrange_queryrangebase.PrometheusResponseHeader `` /* 151-byte string literal not displayed */
}

func (*LokiSeriesResponse) Descriptor

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

func (*LokiSeriesResponse) Equal

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

func (*LokiSeriesResponse) GetData

func (*LokiSeriesResponse) GetHeaders

func (*LokiSeriesResponse) GetStatus

func (m *LokiSeriesResponse) GetStatus() string

func (*LokiSeriesResponse) GetVersion

func (m *LokiSeriesResponse) GetVersion() uint32

func (*LokiSeriesResponse) GoString

func (this *LokiSeriesResponse) GoString() string

func (*LokiSeriesResponse) Marshal

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

func (*LokiSeriesResponse) MarshalTo

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

func (*LokiSeriesResponse) MarshalToSizedBuffer

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

func (*LokiSeriesResponse) ProtoMessage

func (*LokiSeriesResponse) ProtoMessage()

func (*LokiSeriesResponse) Reset

func (m *LokiSeriesResponse) Reset()

func (*LokiSeriesResponse) Size

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

func (*LokiSeriesResponse) String

func (this *LokiSeriesResponse) String() string

func (*LokiSeriesResponse) Unmarshal

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

func (*LokiSeriesResponse) XXX_DiscardUnknown

func (m *LokiSeriesResponse) XXX_DiscardUnknown()

func (*LokiSeriesResponse) XXX_Marshal

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

func (*LokiSeriesResponse) XXX_Merge

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

func (*LokiSeriesResponse) XXX_Size

func (m *LokiSeriesResponse) XXX_Size() int

func (*LokiSeriesResponse) XXX_Unmarshal

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

type PrometheusExtractor

type PrometheusExtractor struct{}

PrometheusExtractor implements Extractor interface

func (PrometheusExtractor) Extract

Extract wraps the original prometheus cache extractor

func (PrometheusExtractor) ResponseWithoutHeaders

func (PrometheusExtractor) ResponseWithoutHeaders(resp queryrangebase.Response) queryrangebase.Response

ResponseWithoutHeaders wraps the original prometheus caching without headers

type ShardingConfigs

type ShardingConfigs []chunk.PeriodConfig

ShardingConfigs is a slice of chunk shard configs

func (ShardingConfigs) GetConf

GetConf will extract a shardable config corresponding to a request and the shardingconfigs

func (ShardingConfigs) ValidRange

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 SplitByMetrics

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

func NewSplitByMetrics

func NewSplitByMetrics(r prometheus.Registerer) *SplitByMetrics

type Splitter

type Splitter func(req queryrangebase.Request, interval time.Duration) ([]queryrangebase.Request, error)

type Stopper

type Stopper interface {
	Stop()
}

Stopper gracefully shutdown resources created

func NewTripperware

func NewTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	schema chunk.SchemaConfig,
	registerer prometheus.Registerer,
) (queryrangebase.Tripperware, Stopper, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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