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

Update Bundle analysis Schema and add GQL cleanup step #408

Merged
merged 11 commits into from
Feb 22, 2024
Merged

Conversation

JerrySentry
Copy link
Contributor

@JerrySentry JerrySentry commented Feb 21, 2024

Purpose/Motivation

Make a teardown step for GQL request to clean up /tmp directory. This is needed for BA because we load the SQLite file (used as a storage for bundle stats) from GCS into the containers file system in the /tmp dir, we need to delete that file at the end when the entire GQL request is resolved.

Note: Update Shared commit once that is push codecov/shared#129

Relevant ticket: codecov/engineering-team#1068

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@JerrySentry JerrySentry requested a review from a team as a code owner February 21, 2024 16:59
@codecov-staging
Copy link

codecov-staging bot commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.08%. Comparing base (2a0d0e0) to head (667b9e4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #408   +/-   ##
=======================================
  Coverage   96.08%   96.08%           
=======================================
  Files         637      637           
  Lines       16686    16709   +23     
=======================================
+ Hits        16032    16055   +23     
  Misses        654      654           
Flag Coverage Δ
unit 96.08% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 96.08% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codecov-public-qa bot commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2a0d0e0) 96.08% compared to head (667b9e4) 96.08%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #408   +/-   ##
=======================================
  Coverage   96.08%   96.08%           
=======================================
  Files         637      637           
  Lines       16686    16709   +23     
=======================================
+ Hits        16032    16055   +23     
  Misses        654      654           
Flag Coverage Δ
unit 96.08% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 96.08% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
graphql_api/views.py 96.29% <100.00%> (+1.46%) ⬆️
services/bundle_analysis.py 100.00% <100.00%> (ø)

Impacted file tree graph

Copy link

codecov bot commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5111f78) 95.80% compared to head (c84ad4b) 95.80%.

Changes have been made to critical files, which contain lines commonly executed in production. Learn more

Additional details and impacted files
@@          Coverage Diff           @@
##            main    #408    +/-   ##
======================================
  Coverage   95.80   95.80            
======================================
  Files        757     757            
  Lines      17252   17390   +138     
======================================
+ Hits       16527   16659   +132     
- Misses       725     731     +6     
Flag Coverage Δ
unit 96.10% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 96.10% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JerrySentry JerrySentry changed the title fix: Bundle analysis GQL Schema and cleaup fix: Bundle analysis GQL Schema and cleanup Feb 21, 2024
@JerrySentry JerrySentry changed the title fix: Bundle analysis GQL Schema and cleanup fix: update Bundle analysis Schema and add GQL cleanup step Feb 21, 2024
@@ -109,8 +109,8 @@ def __init__(self, report: SharedBundleAnalysisReport):
self.cleanup()

def cleanup(self) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't do the full cleanup since that will delete the DB temp file prematurely.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need the cleanup at this level? I feel having a cleanup here might be more confusing than not, since all connection related stuff should be done at the parent (shared) level

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We still need this for now, but you're right it shouldn't have to do this on this level. Reason being on the shared.BundleAnalysisReport it is still relying on the implementation of manually closing connections. I didn't want to touch that in the current shared PR because BundleAnalysisReport is too intertwined with worker as well. But yeah next step I need to make some changes to BundleAnalysisReport class

@JerrySentry JerrySentry changed the title fix: update Bundle analysis Schema and add GQL cleanup step Update Bundle analysis Schema and add GQL cleanup step Feb 21, 2024
@@ -50,7 +93,8 @@ async def post(self, request, *args, **kwargs):
log.info("GraphQL Request", extra=log_data)

# request.user = await get_user(request) or AnonymousUser()
return await super().post(request, *args, **kwargs)
with RequestFinalizer():
return await super().post(request, *args, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's a way for us to see/measure a connection being closed through this code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean? All requests comes to this code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Like how do we know this code indeed closed a connection after the fact, is there a utility or metric that shows live connection before, during and after?

Copy link

@barnett-yuxiang barnett-yuxiang left a comment

Choose a reason for hiding this comment

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

LGTM

@JerrySentry JerrySentry merged commit 662457e into main Feb 22, 2024
19 of 20 checks passed
@JerrySentry JerrySentry deleted the ba_0.5_part_2 branch February 22, 2024 21:29
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.

None yet

3 participants