-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Bugfixes for detected labels API #12466
Conversation
@@ -1403,7 +1403,7 @@ func (i *Ingester) GetDetectedLabels(ctx context.Context, req *logproto.Detected | |||
} | |||
result := make(map[string]*logproto.UniqueLabelValues) | |||
for label, values := range labelMap { | |||
uniqueValues := make([]string, len(values)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use of make introduced blank values in the slice
@@ -1389,7 +1389,7 @@ func (i *Ingester) GetDetectedLabels(ctx context.Context, req *logproto.Detected | |||
} | |||
var matchers []*labels.Matcher | |||
if req.Query != "" { | |||
matchers, err := syntax.ParseMatchers(req.Query, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:= again after declaring zero value above 🧠
mergedResult := make(map[string]*logproto.UniqueLabelValues) | ||
for label, val := range labelMap { | ||
uniqueValues := slices.CompactFunc(val, strings.EqualFold) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compact only works for dedupe if values are sorted
@@ -915,7 +915,7 @@ func (q *SingleTenantQuerier) DetectedLabels(ctx context.Context, req *logproto. | |||
|
|||
g, ctx := errgroup.WithContext(ctx) | |||
ingesterQueryInterval, _ := q.buildQueryIntervals(*req.Start, *req.End) | |||
if !q.cfg.QueryStoreOnly { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Many bug fixes, few tests proving it's fixes. Please add more in follow up PR.
What this PR does / why we need it:
Fixes bug in the detected labels API.