Skip to content

Conversation

@ceorourke
Copy link
Member

Follow up to comments on #69167 to not pass the Redis buffer to apply_delayed, and also a minor comment to rename a function.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 25, 2024
@ceorourke ceorourke requested review from a team and wedamija April 25, 2024 19:50
for rulegroup_to_event in rulegroup_to_events:
for rule_group in rulegroup_to_event.keys():
rule_id, group_id = rule_group.split(":")
rule_id, group_id = rule_group.decode("utf-8").split(":")
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to decode here? If this is bytes, we should change the type of rulegroup_to_events. But it might be better to change get_hash to perform the decoding instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it's bytes, this was wrong before probably because we were mocking the return value so it was missed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok I addressed this and also the fact that redis returns stuff in a list and we're always accessing the 0 index by doing the decoding and indexing in the buffer so it's cleaner to use later on

@codecov
Copy link

codecov bot commented Apr 25, 2024

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 79.84%. Comparing base (5ea6250) to head (3f38325).
Report is 26 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #69700       +/-   ##
===========================================
+ Coverage   57.90%   79.84%   +21.94%     
===========================================
  Files        6460     6469        +9     
  Lines      287234   287692      +458     
  Branches    49525    49586       +61     
===========================================
+ Hits       166333   229721    +63388     
+ Misses     120504    57579    -62925     
+ Partials      397      392        -5     
Files Coverage Δ
src/sentry/buffer/redis.py 92.61% <100.00%> (+64.13%) ⬆️
src/sentry/rules/conditions/event_frequency.py 92.09% <100.00%> (+54.79%) ⬆️
src/sentry/rules/processing/delayed_processing.py 93.51% <100.00%> (+61.11%) ⬆️
src/sentry/buffer/base.py 87.80% <50.00%> (+41.85%) ⬆️

... and 1953 files with indirect coverage changes

) -> dict[str, str]:
key = self._make_key(model, field)
return self._execute_redis_operation(key, RedisOperation.HASH_GET_ALL)
redis_hash = self._execute_redis_operation(key, RedisOperation.HASH_GET_ALL)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should also have _execute_redis_operation only return a single value. We always either make one call in the pipeline, or a second call to set expire, but I don't know that we ever care about the result of that second call?

Might be a nicer interface to just return the value of the operation you requested

@ceorourke ceorourke merged commit d3680f3 into master Apr 26, 2024
@ceorourke ceorourke deleted the ceorourke/dont-pass-buffer branch April 26, 2024 16:20
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants