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

perf: replace json parser with orjson #71155

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented May 20, 2024

Part of orjson move to get rid of sentry.utils.json

@anonrig anonrig requested review from a team as code owners May 20, 2024 13:26
@anonrig anonrig requested review from Lms24 and andreiborza and removed request for a team May 20, 2024 13:26
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 20, 2024
Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

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

@@ -416,7 +416,7 @@ def _find_source_file_in_artifact_indexes(self):
self._get_dist_matched_artifact_index_release_file()
)
if dist_matched_artifact_index_release_file is not None:
raw_data = json.load(dist_matched_artifact_index_release_file.file.getfile())
raw_data = orjson.loads(dist_matched_artifact_index_release_file.file.getfile().read())
Copy link
Member

Choose a reason for hiding this comment

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

oh interesting, this might be the leaked socket I've been looking for

each call to getfile should be wrapped in context manager otherwise it leaks a file descriptor

no need to fix here though

Copy link
Member Author

Choose a reason for hiding this comment

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

nice

@anonrig anonrig enabled auto-merge (squash) May 20, 2024 13:38
Copy link

codecov bot commented May 20, 2024

Codecov Report

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

Project coverage is 77.74%. Comparing base (7798463) to head (42515a0).
Report is 1 commits behind head on master.

Current head 42515a0 differs from pull request most recent head eb7177e

Please upload reports for the commit eb7177e to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #71155      +/-   ##
==========================================
- Coverage   77.86%   77.74%   -0.13%     
==========================================
  Files        6528     6528              
  Lines      290845   290849       +4     
  Branches    50338    50338              
==========================================
- Hits       226467   226108     -359     
- Misses      58128    58523     +395     
+ Partials     6250     6218      -32     
Files Coverage Δ
src/sentry/backup/crypto.py 91.02% <100.00%> (-0.06%) ⬇️
src/sentry/backup/imports.py 92.69% <100.00%> (-0.04%) ⬇️
src/sentry/backup/sanitize.py 90.90% <100.00%> (ø)
src/sentry/buffer/redis.py 78.68% <100.00%> (-9.47%) ⬇️
src/sentry/cache/redis.py 100.00% <100.00%> (ø)
src/sentry/charts/chartcuterie.py 80.76% <100.00%> (ø)
src/sentry/db/models/fields/array.py 100.00% <100.00%> (ø)
src/sentry/db/models/fields/gzippeddict.py 70.00% <100.00%> (ø)
src/sentry/db/models/fields/jsonfield.py 87.77% <100.00%> (ø)
src/sentry/eventstream/snuba.py 82.92% <100.00%> (+2.59%) ⬆️
... and 10 more

... and 39 files with indirect coverage changes

@anonrig anonrig force-pushed the anonrig/more-orjson-why-not branch from 42515a0 to eb7177e Compare May 20, 2024 14:38
@anonrig anonrig disabled auto-merge May 20, 2024 14:38
@anonrig
Copy link
Member Author

anonrig commented May 20, 2024

@asottile-sentry Can you re-review? I had to make some changes due to failing tests.

Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

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

@anonrig anonrig enabled auto-merge (squash) May 20, 2024 14:45
@anonrig anonrig force-pushed the anonrig/more-orjson-why-not branch from eb7177e to b6e4e87 Compare May 20, 2024 15:05
@anonrig anonrig merged commit 63cb2b2 into master May 20, 2024
48 checks passed
@anonrig anonrig deleted the anonrig/more-orjson-why-not branch May 20, 2024 15:33
Copy link

sentry-io bot commented May 20, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: Dict key must be str sentry.tasks.digests.deliver_digest View Issue

Did you find this useful? React with a 👍 or 👎

Copy link

sentry-io bot commented May 20, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: Dict key must be str sentry.tasks.digests.deliver_digest View Issue

Did you find this useful? React with a 👍 or 👎

anonrig added a commit that referenced this pull request May 20, 2024
@wedamija wedamija added the Trigger: Revert add to a merged PR to revert it (skips CI) label May 20, 2024
@getsentry-bot
Copy link
Contributor

PR reverted: c7ebc22

getsentry-bot added a commit that referenced this pull request May 20, 2024
This reverts commit 63cb2b2.

Co-authored-by: wedamija <6288560+wedamija@users.noreply.github.com>
anonrig added a commit that referenced this pull request May 20, 2024
cmanallen pushed a commit that referenced this pull request May 21, 2024
Part of `orjson` move to get rid of `sentry.utils.json`
cmanallen pushed a commit that referenced this pull request May 21, 2024
cmanallen pushed a commit that referenced this pull request May 21, 2024
This reverts commit 63cb2b2.

Co-authored-by: wedamija <6288560+wedamija@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 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 Trigger: Revert add to a merged PR to revert it (skips CI)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants