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

ref(ownership): refactor post_process telemetry #78979

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

JoshFerge
Copy link
Member

@JoshFerge JoshFerge commented Oct 10, 2024

I was finding this code very hard to read with all of the telemetry context creations and indentation. No behavior changes intended.

  • Taking advantage of metrics.wraps and sentry_sdk.trace we can get rid of most of these.
  • Additionally, i've removed the spans around the caching operations as all of our cache get / sets get instrumented with spans anways.
  • Utilize return early pattern to prevent more nesting
  • we don't need a wrapper to try / except the whole function as post process already does this

@JoshFerge JoshFerge requested a review from a team as a code owner October 10, 2024 21:56
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 10, 2024
},
):
# see ProjectOwnership.get_issue_owners
issue_owners: Sequence[tuple[Rule, Sequence[Team | RpcUser], str]] = []
Copy link
Member

Choose a reason for hiding this comment

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

do we need to go through handle_invalid_group_owners in this branch? the old code without the early-return would eventually call handle_invalid_group_owners(group).

Copy link
Member

Choose a reason for hiding this comment

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

although imo if the killswitch is set, returning without doing anything seems like the right call

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, this is a fair point. it is a behavior change. i'll modify the function to call handle_invalid_group_owners. i feel suspicious about even hitting that if the killswitch is activated, but will keep the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

went ahead and changed that else back

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 89.18919% with 4 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/tasks/post_process.py 88.57% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #78979      +/-   ##
==========================================
- Coverage   78.29%   78.29%   -0.01%     
==========================================
  Files        7130     7128       -2     
  Lines      313632   313603      -29     
  Branches    51170    51172       +2     
==========================================
- Hits       245568   245541      -27     
+ Misses      61650    61644       -6     
- Partials     6414     6418       +4     

@JoshFerge JoshFerge merged commit cdbc6c3 into master Oct 11, 2024
51 of 52 checks passed
@JoshFerge JoshFerge deleted the jferg/codeown-post-ref branch October 11, 2024 17:25
@github-actions github-actions bot locked and limited conversation to collaborators Oct 27, 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.

2 participants