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

Memoize session.aggregation_key #1892

Merged
merged 2 commits into from
Sep 14, 2022
Merged

Conversation

sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Sep 14, 2022

probably fixes #1891

(this is the only hypothesis I have currently for that error happening)

@codecov-commenter
Copy link

codecov-commenter commented Sep 14, 2022

Codecov Report

Base: 98.40% // Head: 98.39% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (85fba72) compared to base (67bbcd7).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1892      +/-   ##
==========================================
- Coverage   98.40%   98.39%   -0.02%     
==========================================
  Files         148      148              
  Lines        8886     8885       -1     
==========================================
- Hits         8744     8742       -2     
- Misses        142      143       +1     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/session.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/breadcrumb.rb 96.29% <0.00%> (-3.71%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

Copy link
Collaborator

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add a changelog entry, thx

@pending_aggregates[session.aggregation_key] ||= init_aggregates(session.aggregation_key)
@pending_aggregates[session.aggregation_key][session.status] += 1

aggregation_key = session.aggregation_key
Copy link
Collaborator

@st0012 st0012 Sep 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the aggregation_key method memoizes its value then? Or should we rename it to generate_aggregation_key?

The fact that a *_key method generates different value every time it's called feels like a trap to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait no, I was just fixing this blindly. The key should not change because it always picks started, wtf.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how else this error could happen then, I will memoize anyway and let's see if it fixes this user's problem.

@st0012 st0012 added this to In progress in 5.x via automation Sep 14, 2022
@st0012 st0012 added this to the 5.5.0 milestone Sep 14, 2022
@sl0thentr0py sl0thentr0py changed the title Fix session.aggregation_key being different due to changing timestamps Memoize session.aggregation_key Sep 14, 2022
@sl0thentr0py sl0thentr0py merged commit d872488 into master Sep 14, 2022
5.x automation moved this from In progress to Done Sep 14, 2022
@sl0thentr0py sl0thentr0py deleted the neel/fix-session-aggregation-key branch September 14, 2022 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
5.x
Done
Development

Successfully merging this pull request may close these issues.

undefined method `[]' for nil:NilClass in session.flusher.rb
3 participants