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/feat: use new generator variants of list_repos in sync_repos #122

Merged
merged 3 commits into from
Oct 23, 2023

Conversation

matt-codecov
Copy link
Contributor

updates shared to pull in codecov/shared#46 (generator versions of list_repos) and codecov/shared#41 (feature flag rollout util)

introduces a usage of the new Feature util to control rollout for a speed and UX improvement in sync_repos. currently it is rolled out to 0% of users but codecov repos are manually opted into it.

the problem: list_repos() frontloads fetching and doing light processing on every page of repos from the git provider before returning. when syncing hundreds of repos, the UI just has to spin and spin for potentially minutes and a new user can't see any progress that repos are being ingested into the system until they all appear at the very end.

the change (in shared): @adrian-codecov suggested making list_repos() a generator so that it can yield a page at a time back to sync_repos and sync_repos can incrementally feed repos into the database. if the UI refreshes its viewport or whatever, it will begin to see updated repos which probably makes for a better experience.

additionally, github syncs with this feature should go faster overall. github lets us fetch the total number of repos which we can use to precompute the range of pages, and therefore the list of page URLs, that we need to fetch. knowing the list of urls in advance lets us initiate all the fetches concurrently.

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.

@codecov-staging
Copy link

codecov-staging bot commented Sep 28, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@43fb628). Click here to learn what that means.
The diff coverage is 94.06%.

❗ Current head 2aea791 differs from pull request most recent head 013c387. Consider uploading reports for the commit 013c387 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #122   +/-   ##
=======================================
  Coverage        ?   98.42%           
=======================================
  Files           ?      342           
  Lines           ?    26728           
  Branches        ?        0           
=======================================
  Hits            ?    26307           
  Misses          ?      421           
  Partials        ?        0           
Flag Coverage Δ
integration 98.42% <94.06%> (?)
latest-uploader-overall 98.42% <94.06%> (?)
unit 98.42% <94.06%> (?)

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

Components Coverage Δ
NonTestCode 96.97% <86.79%> (?)
OutsideTasks 98.19% <85.71%> (?)
Files Coverage Δ
tasks/tests/unit/test_sync_repos_task.py 100.00% <100.00%> (ø)
rollouts/__init__.py 85.71% <85.71%> (ø)
tasks/sync_repos.py 96.51% <86.95%> (ø)

@codecov-public-qa
Copy link

codecov-public-qa bot commented Sep 28, 2023

Codecov Report

Merging #122 (013c387) into main (43fb628) will increase coverage by 0.00%.
The diff coverage is 94.06%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #122   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         347      348    +1     
  Lines       27287    27375   +88     
=======================================
+ Hits        26859    26947   +88     
  Misses        428      428           
Flag Coverage Δ
integration 98.43% <94.06%> (+<0.01%) ⬆️
latest-uploader-overall 98.43% <94.06%> (+<0.01%) ⬆️
unit 98.43% <94.06%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.98% <86.79%> (+<0.01%) ⬆️
OutsideTasks 98.23% <85.71%> (-0.01%) ⬇️
Files Coverage Δ
tasks/tests/unit/test_sync_repos_task.py 100.00% <100.00%> (ø)
rollouts/__init__.py 85.71% <85.71%> (ø)
tasks/sync_repos.py 96.51% <86.95%> (+1.11%) ⬆️

@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Merging #122 (013c387) into main (43fb628) will increase coverage by 0.07%.
The diff coverage is 94.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
+ Coverage   98.39%   98.46%   +0.07%     
==========================================
  Files         373      374       +1     
  Lines       27783    27866      +83     
==========================================
+ Hits        27336    27438     +102     
+ Misses        447      428      -19     
Flag Coverage Δ
integration 98.43% <94.06%> (+<0.01%) ⬆️
latest-uploader-overall 98.43% <94.06%> (+<0.01%) ⬆️
unit 98.43% <94.06%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 97.04% <86.79%> (+0.17%) ⬆️
OutsideTasks 98.23% <85.71%> (-0.01%) ⬇️
Files Coverage Δ
tasks/tests/unit/test_sync_repos_task.py 100.00% <100.00%> (ø)
rollouts/__init__.py 85.71% <85.71%> (ø)
tasks/sync_repos.py 96.53% <86.95%> (+1.10%) ⬆️

... and 3 files with indirect coverage changes

Related Entrypoints
run/app.tasks.sync_repos.SyncRepos

Copy link
Contributor

@giovanni-guidini giovanni-guidini left a comment

Choose a reason for hiding this comment

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

image

Nice how you re-used all tests and tested both paths 👍
Strange to have unit tests that actually make a request to an external service

@codecov-qa
Copy link

codecov-qa bot commented Oct 23, 2023

Codecov Report

Merging #122 (013c387) into main (43fb628) will increase coverage by 0.00%.
The diff coverage is 94.06%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #122   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         347      348    +1     
  Lines       27287    27375   +88     
=======================================
+ Hits        26859    26947   +88     
  Misses        428      428           
Flag Coverage Δ
integration 98.43% <94.06%> (+<0.01%) ⬆️
latest-uploader-overall 98.43% <94.06%> (+<0.01%) ⬆️
unit 98.43% <94.06%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.98% <86.79%> (+<0.01%) ⬆️
OutsideTasks 98.23% <85.71%> (-0.01%) ⬇️
Files Coverage Δ
tasks/tests/unit/test_sync_repos_task.py 100.00% <100.00%> (ø)
rollouts/__init__.py 85.71% <85.71%> (ø)
tasks/sync_repos.py 96.51% <86.95%> (+1.11%) ⬆️

@matt-codecov matt-codecov merged commit 01fd3cd into main Oct 23, 2023
19 of 26 checks passed
@matt-codecov matt-codecov deleted the matt/sync-repos-generator-feature branch October 23, 2023 20:41
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.

2 participants