-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
perf: Improve Detected labels API #12816
Conversation
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.
looks good, just a few small things.
return false | ||
_, err := strconv.ParseFloat(v, 64) | ||
if err != nil { | ||
_, err = uuid.Parse(v) |
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.
much cleaner than the regex pattern
} | ||
detectedLabels = append(detectedLabels, &logproto.DetectedLabel{ | ||
Label: k, | ||
Cardinality: v.Estimate(), |
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.
yeah, good call here, we hopefully don't care about this but if there's only 1 split we'll need the estimate here
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.
sorry didn't get the issue.. even if there's a 1 split, the estimate will be populated here right?
var result []*logproto.DetectedLabel | ||
|
||
for _, dl := range resp.Response.DetectedLabels { | ||
if dl.Cardinality > 2 && dl.Cardinality < 50 { |
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.
I still get confused by our middlewares, so just to make sure, this is happening after we MergeLabels
right? I wouldn't want to omit results based on partial cardinality of a subquery.
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.
yes confirmed again this is executed after MergeLabels. The line res, err := rt.Do(ctx, req)
is before everything else in this function
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Checklist
CONTRIBUTING.md
guide (required)docs/sources/setup/upgrade/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PRdeprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR