Skip to content

Fix EvictedQueue bug with zero capacity #1151

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

Merged
merged 2 commits into from
Jul 19, 2023

Conversation

wperron
Copy link
Contributor

@wperron wperron commented Jul 14, 2023

The EvictedQueue was checking for the length before inserting, and popping extra items, then doing the insertion. In the case where the capacity is set to zero, it caused the pop operation to be a no-op on the first insert, and then insert an item anyway.

This commit fixes the issue by moving the length check after the insert and popping any extra items.

Fixes #1148

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@wperron wperron requested a review from a team July 14, 2023 15:07
The EvictedQueue was checking for the length _before_ inserting, and
popping extra items, then doing the insertion. In the case where the
capacity is set to zero, it caused the pop operation to be a no-op on
the first insert, and then insert an item anyway.

This commit fixes the issue by moving the length check after the insert
and popping any extra items.

Fixes open-telemetry#1148
@wperron wperron force-pushed the evicted-queue-zero-cap branch from b1dc080 to 2581c4d Compare July 14, 2023 15:22
@jtescher
Copy link
Member

@wperron should get your lint issues resolved if you merge the changes currently on the main branch

@wperron
Copy link
Contributor Author

wperron commented Jul 17, 2023

On vacation right now, will do when I get back in ~2 weeks 👍

@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Patch coverage: 100.0% and no project coverage change.

Comparison is base (0b979a6) 49.4% compared to head (ffc78f9) 49.4%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1151   +/-   ##
=====================================
  Coverage   49.4%   49.4%           
=====================================
  Files        164     164           
  Lines      20430   20445   +15     
=====================================
+ Hits       10105   10120   +15     
  Misses     10325   10325           
Impacted Files Coverage Δ
opentelemetry-sdk/src/trace/evicted_queue.rs 93.1% <100.0%> (+1.7%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jtescher
Copy link
Member

All good, looks like I can merge main for you as well.

@jtescher jtescher merged commit b28e41a into open-telemetry:main Jul 19, 2023
@wperron
Copy link
Contributor Author

wperron commented Aug 7, 2023

@jtescher thanks, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpanLimits going over limit set for max events per spans
3 participants