Documentation ¶
Index ¶
- Constants
- func ParseMatchers(input string) ([]*labels.Matcher, error)
- type Engine
- type EngineOpts
- type Expr
- type Filter
- type LogSelectorExpr
- type ParseError
- type Querier
- type QuerierFunc
- type Query
- type RangeVectorAggregator
- type RangeVectorIterator
- type SampleExpr
- type SelectParams
- type StepEvaluator
- type StepEvaluatorFn
- type Streams
- type TagMatcher
Constants ¶
const ( OpTypeSum = "sum" OpTypeAvg = "avg" OpTypeMax = "max" OpTypeMin = "min" OpTypeCount = "count" OpTypeStddev = "stddev" OpTypeStdvar = "stdvar" OpTypeBottomK = "bottomk" OpTypeTopK = "topk" OpTypeCountOverTime = "count_over_time" OpTypeRate = "rate" )
const AVG = 57371
const BOTTOMK = 57377
const BY = 57366
const CLOSE_BRACE = 57356
const CLOSE_BRACKET = 57358
const CLOSE_PARENTHESIS = 57365
const COMMA = 57359
const COUNT = 57374
const COUNT_OVER_TIME = 57368
const DOT = 57360
const DURATION = 57348
const EQ = 57351
const IDENTIFIER = 57346
const LABELS = 57350
const MATCHERS = 57349
const MAX = 57372
const MIN = 57373
const NEQ = 57352
const NRE = 57354
const OPEN_BRACE = 57355
const OPEN_BRACKET = 57357
const OPEN_PARENTHESIS = 57364
const PIPE_EXACT = 57362
const PIPE_MATCH = 57361
const RATE = 57369
const RE = 57353
const SLASH = 57363
const STDDEV = 57375
const STDVAR = 57376
const STRING = 57347
const SUM = 57370
const TOPK = 57378
const ValueTypeStreams = "streams"
ValueTypeStreams promql.ValueType for log streams
const WITHOUT = 57367
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶ added in v0.4.0
type Engine struct {
// contains filtered or unexported fields
}
Engine is the LogQL engine.
func NewEngine ¶ added in v0.4.0
func NewEngine(opts EngineOpts) *Engine
NewEngine creates a new LogQL engine.
type EngineOpts ¶ added in v0.4.0
type EngineOpts struct { // Timeout for queries execution Timeout time.Duration `yaml:"timeout"` // MaxLookBackPeriod is the maximun amount of time to look back for log lines. // only used for instant log queries. MaxLookBackPeriod time.Duration `yaml:"max_look_back_period"` }
EngineOpts is the list of options to use with the LogQL query engine.
type Expr ¶
type Expr interface{}
Expr is the root expression which can be a SampleExpr or LogSelectorExpr
type LogSelectorExpr ¶ added in v0.4.0
type LogSelectorExpr interface { Tags() ([]*TagMatcher, []Filter) Filter() (Filter, error) Matchers() []*labels.Matcher fmt.Stringer }
LogSelectorExpr is a LogQL expression filtering and returning logs.
func NewFilterExpr ¶
func NewFilterExpr(left LogSelectorExpr, ty labels.MatchType, match string) LogSelectorExpr
NewFilterExpr wraps an existing Expr with a next filter expression.
func ParseLogSelector ¶ added in v0.4.0
func ParseLogSelector(input string) (LogSelectorExpr, error)
ParseLogSelector parses a log selector expression `{app="foo"} |= "filter"`
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
ParseError is what is returned when we failed to parse.
func (ParseError) Error ¶
func (p ParseError) Error() string
type Querier ¶
type Querier interface {
Select(context.Context, SelectParams) (iter.EntryIterator, error)
}
Querier allows a LogQL expression to fetch an EntryIterator for a set of matchers and filters
type QuerierFunc ¶
type QuerierFunc func(context.Context, SelectParams) (iter.EntryIterator, error)
QuerierFunc implements Querier.
func (QuerierFunc) Select ¶ added in v0.4.0
func (q QuerierFunc) Select(ctx context.Context, p SelectParams) (iter.EntryIterator, error)
Select implements Querier.
type Query ¶ added in v0.4.0
type Query interface { // Exec processes the query. Exec(ctx context.Context) (promql.Value, error) }
Query is a LogQL query to be executed.
type RangeVectorAggregator ¶ added in v0.4.0
RangeVectorAggregator aggregates samples for a given range of samples. It receives the current milliseconds timestamp and the list of point within the range.
type RangeVectorIterator ¶ added in v0.4.0
type RangeVectorIterator interface { Next() bool At(aggregator RangeVectorAggregator) (int64, promql.Vector) Close() error }
RangeVectorIterator iterates through a range of samples. To fetch the current vector use `At` with a `RangeVectorAggregator`.
type SampleExpr ¶ added in v0.4.0
type SampleExpr interface { // Selector is the LogQL selector to apply when retrieving logs. Selector() LogSelectorExpr // Evaluator returns a `StepEvaluator` that can evaluate the expression step by step Evaluator() StepEvaluator // Close all resources used. Close() error }
SampleExpr is a LogQL expression filtering logs and returning metric samples.
type SelectParams ¶ added in v0.4.0
type SelectParams struct {
*logproto.QueryRequest
}
SelectParams specifies parameters passed to data selections.
func (SelectParams) LogSelector ¶ added in v0.4.0
func (s SelectParams) LogSelector() (LogSelectorExpr, error)
LogSelector returns the LogSelectorExpr from the SelectParams. The `LogSelectorExpr` can then returns all matchers and filters to use for that request.
type StepEvaluator ¶ added in v0.4.0
StepEvaluator evaluate a single step of a query.
type StepEvaluatorFn ¶ added in v0.4.0
StepEvaluatorFn is a function to chain multiple `StepEvaluator`.
type Streams ¶ added in v0.4.0
Streams is promql.Value
type TagMatcher ¶ added in v0.4.0
Tag represents a high-cardinality KV label. It does not participate the computation of the streamID, so it will not affect the granularity of the aggregation of chunks.
Tag will store a different index entry, it points to the chunk which contains the log line which has the tag.
When performing a query, tag will be used to determine which chunk to look at, and it will return a Filter func just like any other Filter. And you should use it to filter the lines within that chunk.
func (*TagMatcher) String ¶ added in v0.4.0
func (t *TagMatcher) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package marshal converts internal objects to loghttp model objects.
|
Package marshal converts internal objects to loghttp model objects. |
legacy
Package marshal converts internal objects to loghttp model objects.
|
Package marshal converts internal objects to loghttp model objects. |