Skip to content

Commit

Permalink
fix(traceqlengine): sort traces before returning
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed May 31, 2024
1 parent 4ad1786 commit a1a5a49
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/traceql/traceqlengine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package traceqlengine

import (
"context"
"slices"
"time"

"github.com/go-faster/errors"
Expand Down Expand Up @@ -199,10 +200,13 @@ func (e *Engine) evalExpr(ctx context.Context, expr traceql.Expr, params EvalPar
})
}
}

if err := iter.Err(); err != nil {
return nil, err
}

slices.SortFunc(result, func(a, b tempoapi.TraceSearchMetadata) int {
return a.StartTimeUnixNano.Compare(b.StartTimeUnixNano)
})
return &tempoapi.Traces{Traces: result}, nil
}

Expand Down

0 comments on commit a1a5a49

Please sign in to comment.