Skip to content

Commit

Permalink
fix(chstorage): sort metric labels and label values before returning
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Jun 11, 2024
1 parent d214c03 commit 9f3598e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/chstorage/querier_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func (p *promQuerier) getLabelValues(ctx context.Context, labelName string, matc
}
query.Where(expr)
}
query.Order(chsql.Ident(valueColumn), chsql.Asc)

if err := p.do(ctx, selectQuery{
Query: query,
Expand Down Expand Up @@ -384,7 +385,8 @@ func (p *promQuerier) getLabelNames(ctx context.Context) (result []string, rerr
var (
value = new(proto.ColStr).LowCardinality()
query = chsql.Select(table, chsql.Column("name_normalized", value)).
Distinct(true)
Distinct(true).
Order(chsql.Ident("name_normalized"), chsql.Asc)
)
if err := p.do(ctx, selectQuery{
Query: query,
Expand Down

0 comments on commit 9f3598e

Please sign in to comment.