Documentation ¶
Overview ¶
Package logqlmetric provides metric queries implementation.
Index ¶
- func ReadStepResponse(iter iterators.Iterator[Step], instant bool) (s lokiapi.QueryResponseData, _ error)
- type Aggregator
- type AvgAggregator
- type AvgOverTime
- type BatchAggregator
- type BytesRate
- type CountAggregator
- type CountOverTime
- type EvalParams
- type FPoint
- type FirstOverTime
- type LastOverTime
- type MaxAggregator
- type MaxOverTime
- type MinAggregator
- type MinOverTime
- type QuantileOverTime
- type Rate
- type RateCounter
- type Sample
- type SampleOp
- type SampleSelector
- type SampledEntry
- type Series
- type StddevAggregator
- type StddevOverTime
- type StdvarAggregator
- type StdvarOverTime
- type Step
- type StepIterator
- func BinOp(left, right StepIterator, expr *logql.BinOpExpr) (StepIterator, error)
- func Build(expr logql.MetricExpr, sel SampleSelector, params EvalParams) (StepIterator, error)
- func LabelReplace(iter StepIterator, expr *logql.LabelReplaceExpr) (StepIterator, error)
- func LiteralBinOp(iter StepIterator, expr *logql.BinOpExpr, value float64, left bool) (StepIterator, error)
- func RangeAggregation(iter iterators.Iterator[SampledEntry], expr *logql.RangeAggregationExpr, ...) (StepIterator, error)
- func Vector(expr *logql.VectorExpr, start, end time.Time, step time.Duration) StepIterator
- func VectorAggregation(iter iterators.Iterator[Step], expr *logql.VectorAggregationExpr) (StepIterator, error)
- type SumAggregator
- type SumOverTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadStepResponse ¶
func ReadStepResponse(iter iterators.Iterator[Step], instant bool) (s lokiapi.QueryResponseData, _ error)
ReadStepResponse reads aggregation result into API structure.
Types ¶
type Aggregator ¶
Aggregator is a stateful streaming aggregator.
type AvgAggregator ¶
type AvgAggregator struct {
// contains filtered or unexported fields
}
AvgAggregator implements moving cumulative average aggregation.
func (*AvgAggregator) Result ¶
func (a *AvgAggregator) Result() float64
Result implements Aggregator.
type AvgOverTime ¶
type AvgOverTime = batchApplier[AvgAggregator, *AvgAggregator]
AvgOverTime implements `avg_over_time` aggregation.
type BatchAggregator ¶
BatchAggregator is stateless batch aggregator.
type CountAggregator ¶
type CountAggregator struct {
// contains filtered or unexported fields
}
CountAggregator implements counting aggregation.
func (*CountAggregator) Apply ¶
func (a *CountAggregator) Apply(float64)
Apply implements Aggregator.
func (*CountAggregator) Result ¶
func (a *CountAggregator) Result() float64
Result implements Aggregator.
type CountOverTime ¶
type CountOverTime struct{}
CountOverTime implements `count_over_time` aggregation.
func (CountOverTime) Aggregate ¶
func (CountOverTime) Aggregate(points []FPoint) float64
Aggregate implements BatchAggregator.
type EvalParams ¶
EvalParams is a query evaluation params.
type FPoint ¶
type FPoint struct { Timestamp otelstorage.Timestamp Value float64 }
FPoint is a metric point.
type FirstOverTime ¶
type FirstOverTime struct{}
FirstOverTime implements `first_over_time` aggregation.
func (FirstOverTime) Aggregate ¶
func (FirstOverTime) Aggregate(points []FPoint) float64
Aggregate implements BatchAggregator.
type LastOverTime ¶
type LastOverTime struct{}
LastOverTime implements `last_over_time` aggregation.
func (LastOverTime) Aggregate ¶
func (LastOverTime) Aggregate(points []FPoint) (last float64)
Aggregate implements BatchAggregator.
type MaxAggregator ¶
type MaxAggregator struct {
// contains filtered or unexported fields
}
MaxAggregator implements max aggregation.
func (*MaxAggregator) Result ¶
func (a *MaxAggregator) Result() float64
Result implements Aggregator.
type MaxOverTime ¶
type MaxOverTime = batchApplier[MaxAggregator, *MaxAggregator]
MaxOverTime implements `max_over_time` aggregation.
type MinAggregator ¶
type MinAggregator struct {
// contains filtered or unexported fields
}
MinAggregator implements min aggregation.
func (*MinAggregator) Result ¶
func (a *MinAggregator) Result() float64
Result implements Aggregator.
type MinOverTime ¶
type MinOverTime = batchApplier[MinAggregator, *MinAggregator]
MinOverTime implements `min_over_time` aggregation.
type QuantileOverTime ¶
type QuantileOverTime struct {
// contains filtered or unexported fields
}
QuantileOverTime implements `quantile_over_time` aggregation.
func (QuantileOverTime) Aggregate ¶
func (a QuantileOverTime) Aggregate(points []FPoint) float64
Aggregate implements BatchAggregator.
type Rate ¶
type Rate[A BatchAggregator] struct { // contains filtered or unexported fields }
Rate implements `rate` aggregation.
type RateCounter ¶ added in v0.10.0
type RateCounter struct {
// contains filtered or unexported fields
}
RateCounter implements `rate_counter` aggregation.
func (RateCounter) Aggregate ¶ added in v0.10.0
func (a RateCounter) Aggregate(points []FPoint) float64
Aggregate implements BatchAggregator.
type Sample ¶
type Sample struct { Data float64 Set logqlabels.AggregatedLabels }
Sample is a metric sample extracted from logs.
type SampleSelector ¶
type SampleSelector = func(expr *logql.RangeAggregationExpr, start, end time.Time) (iterators.Iterator[SampledEntry], error)
SampleSelector creates new sampled entry iterator.
type SampledEntry ¶
type SampledEntry struct { Sample float64 Timestamp otelstorage.Timestamp Set logqlabels.AggregatedLabels }
SampledEntry is a sampled log entry.
type Series ¶
type Series struct { Data []FPoint Set logqlabels.AggregatedLabels }
Series is a grouped set of metric points.
type StddevAggregator ¶
type StddevAggregator struct {
// contains filtered or unexported fields
}
StddevAggregator implements standard deviation aggregation.
func (*StddevAggregator) Apply ¶
func (a *StddevAggregator) Apply(v float64)
Apply implements Aggregator.
func (*StddevAggregator) Result ¶
func (a *StddevAggregator) Result() float64
Result implements Aggregator.
type StddevOverTime ¶
type StddevOverTime = batchApplier[StddevAggregator, *StddevAggregator]
StddevOverTime implements `stddev_over_time` aggregation.
type StdvarAggregator ¶
type StdvarAggregator struct {
// contains filtered or unexported fields
}
StdvarAggregator implements standard variance aggregation.
func (*StdvarAggregator) Apply ¶
func (a *StdvarAggregator) Apply(v float64)
Apply implements Aggregator.
func (*StdvarAggregator) Result ¶
func (a *StdvarAggregator) Result() float64
Result implements Aggregator.
type StdvarOverTime ¶
type StdvarOverTime = batchApplier[StdvarAggregator, *StdvarAggregator]
StdvarOverTime implements `stdvar_over_time` aggregation.
type Step ¶
type Step struct { Timestamp otelstorage.Timestamp Samples []Sample }
Step represents a one query range step i
type StepIterator ¶
StepIterator is a one query range step iterator.
func BinOp ¶
func BinOp( left, right StepIterator, expr *logql.BinOpExpr, ) (StepIterator, error)
BinOp returns new step iterator performing binary operation between two iterators.
func Build ¶
func Build(expr logql.MetricExpr, sel SampleSelector, params EvalParams) (StepIterator, error)
Build builds new step iterator.
func LabelReplace ¶
func LabelReplace(iter StepIterator, expr *logql.LabelReplaceExpr) (StepIterator, error)
LabelReplace returns new step iterator performing label replacement.
func LiteralBinOp ¶
func LiteralBinOp( iter StepIterator, expr *logql.BinOpExpr, value float64, left bool, ) (StepIterator, error)
LiteralBinOp returns new step iterator performing binary operation with literal.
func RangeAggregation ¶
func RangeAggregation( iter iterators.Iterator[SampledEntry], expr *logql.RangeAggregationExpr, start, end time.Time, step time.Duration, ) (StepIterator, error)
RangeAggregation creates new range aggregation step iterator.
func Vector ¶
func Vector( expr *logql.VectorExpr, start, end time.Time, step time.Duration, ) StepIterator
Vector creates new vector function step iterator.
func VectorAggregation ¶
func VectorAggregation( iter iterators.Iterator[Step], expr *logql.VectorAggregationExpr, ) (StepIterator, error)
VectorAggregation creates new Vector aggregation step iterator.
type SumAggregator ¶
type SumAggregator struct {
// contains filtered or unexported fields
}
SumAggregator implements moving summing aggregation.
func (*SumAggregator) Result ¶
func (a *SumAggregator) Result() float64
Result implements Aggregator.
type SumOverTime ¶
type SumOverTime = batchApplier[SumAggregator, *SumAggregator]
SumOverTime implements `sum_over_time` aggregation.