Skip to content
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

Merged
merged 3 commits into from
Mar 3, 2025

Conversation

rockdaboot
Copy link
Contributor

@rockdaboot rockdaboot commented Feb 28, 2025

Fixes getLocations(), random encounter when reading the code.

Problem(s)

  1. The code block executed for length > 0 is broken. It should loop from start to start + length but loops from start to length, which only works for start == 0.
  2. The code block executed for length == 0 contains a no-op loop.

Solution
Fix the code to work for all values of length and start.
Additionally, the PR moves the check i < profile.LocationTable().Len() out of the loop body.

@rockdaboot rockdaboot marked this pull request as ready for review February 28, 2025 17:41
@rockdaboot rockdaboot requested a review from a team as a code owner February 28, 2025 17:41
@rockdaboot rockdaboot requested a review from songy23 February 28, 2025 17:41
@rockdaboot rockdaboot changed the title Fix getLocations() [exporter/elasticsearch] Fix getLocations() Feb 28, 2025
Copy link
Contributor

@carsonip carsonip left a 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

@rockdaboot
Copy link
Contributor Author

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.

Copy link
Contributor

@carsonip carsonip left a 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.

@songy23 songy23 merged commit f50b206 into open-telemetry:main Mar 3, 2025
156 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants