Skip to content

Commit

Permalink
fix(logqlengine): remove unwrap label from sampled entry
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Apr 28, 2024
1 parent 5ac42e1 commit 09724e8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions internal/logql/logqlengine/sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,20 @@ func newSampleIterator(iter EntryIterator, expr *logql.RangeAggregationExpr) (*s
var (
by []logql.Label
without []logql.Label

g = expr.Grouping
)
if g := expr.Grouping; g != nil {
if g != nil {
if g.Without {
without = g.Labels
} else {
by = g.Labels
}
} else if unwrap := expr.Range.Unwrap; unwrap != nil {
}
if unwrap := expr.Range.Unwrap; unwrap != nil && (g == nil || g.Without) {
// NOTE(tdakkota): Loki removes label that used to sample entry (convert to metric)
// unless grouping is explicitly specified.
without = []logql.Label{unwrap.Label}
// unless grouping by is explicitly specified.
without = append(without, unwrap.Label)
}

return &sampleIterator{
Expand Down

0 comments on commit 09724e8

Please sign in to comment.