-
Notifications
You must be signed in to change notification settings - Fork 2.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
[exporter/elasticsearch] Fix getLocations() #38274
Conversation
a39c317
to
7ae4eb3
Compare
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.
do you mind expanding on what's broken (in the changelog and in PR description)? I don't have the domain knowledge around profiles locations
Added a comment to the PR. You don't need domain knowledge - it is/was just an issue with the logic. |
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.
thanks, now i get it.
Fixes
getLocations()
, random encounter when reading the code.Problem(s)
length > 0
is broken. It should loop fromstart
tostart + length
but loops fromstart
tolength
, which only works forstart == 0
.length == 0
contains a no-op loop.Solution
Fix the code to work for all values of
length
andstart
.Additionally, the PR moves the check
i < profile.LocationTable().Len()
out of the loop body.