queryrange

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 42 Imported by: 7

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 (

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

Functions

func NewLogFilterTripperware

func NewLogFilterTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	codec queryrange.Codec,
	instrumentMetrics *queryrange.InstrumentMiddlewareMetrics,
	retryMiddlewareMetrics *queryrange.RetryMiddlewareMetrics,
) (frontend.Tripperware, error)

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

func SplitByIntervalMiddleware

func SplitByIntervalMiddleware(limits Limits, merger queryrange.Merger) queryrange.Middleware

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

func StatsCollectorMiddleware added in v1.4.0

func StatsCollectorMiddleware() queryrange.Middleware

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

Types

type Config

type Config struct {
	queryrange.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 Limits added in v1.4.0

type Limits interface {
	queryrange.Limits
	QuerySplitDuration(string) time.Duration
	MaxEntriesLimitPerQuery(string) int
}

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

func WithDefaultLimits added in v1.4.0

func WithDefaultLimits(l Limits, conf queryrange.Config) Limits

WithDefaults will construct a Limits with a default value for QuerySplitDuration when no overrides are present.

type LokiData

type LokiData struct {
	ResultType string                                        `protobuf:"bytes,1,opt,name=ResultType,json=resultType,proto3" json:"resultType"`
	Result     []github_com_grafana_loki_pkg_logproto.Stream `protobuf:"bytes,2,rep,name=Result,json=result,proto3,customtype=github.com/grafana/loki/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) 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 LokiPromResponse added in v1.4.0

type LokiPromResponse struct {
	Response   *queryrange.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 added in v1.4.0

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

func (*LokiPromResponse) Equal added in v1.4.0

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

func (*LokiPromResponse) GetResponse added in v1.4.0

func (*LokiPromResponse) GetStatistics added in v1.4.0

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

func (*LokiPromResponse) GoString added in v1.4.0

func (this *LokiPromResponse) GoString() string

func (*LokiPromResponse) Marshal added in v1.4.0

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

func (*LokiPromResponse) MarshalTo added in v1.4.0

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

func (*LokiPromResponse) ProtoMessage added in v1.4.0

func (*LokiPromResponse) ProtoMessage()

func (*LokiPromResponse) Reset added in v1.4.0

func (m *LokiPromResponse) Reset()

func (*LokiPromResponse) Size added in v1.4.0

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

func (*LokiPromResponse) String added in v1.4.0

func (this *LokiPromResponse) String() string

func (*LokiPromResponse) Unmarshal added in v1.4.0

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

func (*LokiPromResponse) XXX_DiscardUnknown added in v1.4.0

func (m *LokiPromResponse) XXX_DiscardUnknown()

func (*LokiPromResponse) XXX_Marshal added in v1.4.0

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

func (*LokiPromResponse) XXX_Merge added in v1.4.0

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

func (*LokiPromResponse) XXX_Size added in v1.4.0

func (m *LokiPromResponse) XXX_Size() int

func (*LokiPromResponse) XXX_Unmarshal added in v1.4.0

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"`
	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"`
}

func (*LokiRequest) Descriptor

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

func (*LokiRequest) Equal

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

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

func (m *LokiRequest) GetLimit() uint32

func (*LokiRequest) GetPath

func (m *LokiRequest) GetPath() string

func (*LokiRequest) GetQuery

func (m *LokiRequest) GetQuery() 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) Marshal

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

func (*LokiRequest) MarshalTo

func (m *LokiRequest) MarshalTo(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 added in v1.4.0

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

func (*LokiRequest) WithStartEnd

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

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,json=status,proto3" json:"status"`
	Data       LokiData           `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"`
	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"`
}

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

func (m *LokiResponse) GetLimit() uint32

func (*LokiResponse) GetStatistics added in v1.4.0

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) 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 PrometheusExtractor added in v1.5.0

type PrometheusExtractor struct{}

PrometheusExtractor implements Extractor interface

func (PrometheusExtractor) Extract added in v1.5.0

func (PrometheusExtractor) Extract(start, end int64, from queryrange.Response) queryrange.Response

Extract wraps the original prometheus cache extractor

func (PrometheusExtractor) ResponseWithoutHeaders added in v1.5.0

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

ResponseWithoutHeaders wraps the original prometheus caching without headers

type Stopper

type Stopper interface {
	Stop()
}

Stopper gracefully shutdown resources created

func NewMetricTripperware added in v1.4.0

func NewMetricTripperware(
	cfg Config,
	log log.Logger,
	limits Limits,
	codec queryrange.Codec,
	extractor queryrange.Extractor,
	instrumentMetrics *queryrange.InstrumentMiddlewareMetrics,
	retryMiddlewareMetrics *queryrange.RetryMiddlewareMetrics,
) (frontend.Tripperware, Stopper, error)

NewMetricTripperware creates a new frontend tripperware responsible for handling metric queries

func NewTripperware

func NewTripperware(cfg Config, log log.Logger, limits Limits, registerer prometheus.Registerer) (frontend.Tripperware, Stopper, error)

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

Jump to

Keyboard shortcuts

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