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

1348 add gql language task #314

Merged
merged 13 commits into from
Mar 18, 2024
Merged

1348 add gql language task #314

merged 13 commits into from
Mar 18, 2024

Conversation

adrian-codecov
Copy link
Contributor

@adrian-codecov adrian-codecov commented Mar 8, 2024

Add task to sync languages using GQL. Bulk of change is in tasks/sync_repo_languages_gql.py

Reasoning

We have the need to fetch the languages a repository has and up until now we've created a task to do so, sync_repo_languages, aimed to sync languages for all of our providers. We're switching the implementation from REST to GQL for Github as it helps decrease rate limit errors, and we're leaving the REST implementation for the remaining providers as this change did not anticipate making solutions for those providers at the moment (they are also less traffic).

We're adding a brand new task rather than modifying the existing one because of the nature of how each task fetches it's information. The REST task calls the provider's API and fetches a repository's language based on a repository_id, while GQL uses an owner; the REST implementation makes N requests per N repos while the GQL makes M requests for M owners. The REST endpoint mainly decides whether to call or not it's provider's endpoint based on some parameters, while the GQL approach mainly decides which repository to synchronize

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 Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #314      +/-   ##
==========================================
- Coverage   98.11%   98.11%   -0.01%     
==========================================
  Files         385      387       +2     
  Lines       32006    32104      +98     
==========================================
+ Hits        31403    31499      +96     
- Misses        603      605       +2     
Flag Coverage Δ
integration 98.11% <100.00%> (-0.01%) ⬇️
latest-uploader-overall 98.11% <100.00%> (-0.01%) ⬇️
unit 98.11% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
NonTestCode 96.23% <100.00%> (+0.01%) ⬆️
OutsideTasks 97.91% <ø> (ø)
Files Coverage Δ
tasks/__init__.py 100.00% <100.00%> (ø)
tasks/sync_repo_languages_gql.py 100.00% <100.00%> (ø)
tasks/sync_repos.py 96.48% <100.00%> (+0.07%) ⬆️
tasks/tests/unit/test_sync_repo_languages_gql.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_sync_repos_task.py 99.17% <100.00%> (-0.55%) ⬇️

Copy link

codecov-public-qa bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (77e34ba) 98.11% compared to head (b73a38b) 98.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #314      +/-   ##
==========================================
- Coverage   98.11%   98.11%   -0.01%     
==========================================
  Files         385      387       +2     
  Lines       32006    32104      +98     
==========================================
+ Hits        31403    31499      +96     
- Misses        603      605       +2     
Flag Coverage Δ
integration 98.11% <100.00%> (-0.01%) ⬇️
latest-uploader-overall 98.11% <100.00%> (-0.01%) ⬇️
unit 98.11% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
NonTestCode 96.23% <100.00%> (+0.01%) ⬆️
OutsideTasks 97.91% <ø> (ø)
Files Coverage Δ
tasks/__init__.py 100.00% <100.00%> (ø)
tasks/sync_repo_languages_gql.py 100.00% <100.00%> (ø)
tasks/sync_repos.py 96.48% <100.00%> (+0.07%) ⬆️
tasks/tests/unit/test_sync_repo_languages_gql.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_sync_repos_task.py 99.17% <100.00%> (-0.55%) ⬇️

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.10%. Comparing base (77e34ba) to head (b73a38b).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #314   +/-   ##
=======================================
  Coverage   98.10%   98.10%           
=======================================
  Files         416      418    +2     
  Lines       32706    32804   +98     
=======================================
+ Hits        32087    32184   +97     
- Misses        619      620    +1     
Flag Coverage Δ
integration 98.11% <100.00%> (-0.01%) ⬇️
latest-uploader-overall 98.11% <100.00%> (-0.01%) ⬇️
unit 98.11% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
NonTestCode 96.18% <100.00%> (+0.01%) ⬆️
OutsideTasks 97.91% <ø> (ø)
Files Coverage Δ
tasks/__init__.py 100.00% <100.00%> (ø)
tasks/sync_repo_languages_gql.py 100.00% <100.00%> (ø)
tasks/sync_repos.py 97.00% <100.00%> (+0.06%) ⬆️
tasks/tests/unit/test_sync_repo_languages_gql.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_sync_repos_task.py 99.72% <100.00%> (-0.28%) ⬇️
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.

Looks good in general 👍

I would like to ask why you decided to create a new task instead of modifying the old one? Just out of curiosity.

If this is meant to replace that one please add some comment on the beginning of sync_repo_languages.py saying it's deprecated and replaced by the new one.

If that's not the case please add some comment there to explain when to use one or the other

tasks/sync_repo_languages_gql.py Show resolved Hide resolved
tasks/sync_repo_languages_gql.py Outdated Show resolved Hide resolved
tasks/sync_repos.py Show resolved Hide resolved
tasks/tests/unit/test_sync_repo_languages_gql.py Outdated Show resolved Hide resolved
tasks/tests/unit/test_sync_repo_languages_gql.py Outdated Show resolved Hide resolved
@adrian-codecov
Copy link
Contributor Author

@giovanni-guidini thanks for asking! I added a better description on the PR comment to explain this change, let me know if you still have questions.

@codecov-qa
Copy link

codecov-qa bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.11%. Comparing base (77e34ba) to head (b73a38b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #314      +/-   ##
==========================================
- Coverage   98.11%   98.11%   -0.01%     
==========================================
  Files         385      387       +2     
  Lines       32006    32104      +98     
==========================================
+ Hits        31403    31499      +96     
- Misses        603      605       +2     
Flag Coverage Δ
integration 98.11% <100.00%> (-0.01%) ⬇️
latest-uploader-overall 98.11% <100.00%> (-0.01%) ⬇️
unit 98.11% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
NonTestCode 96.23% <100.00%> (+0.01%) ⬆️
OutsideTasks 97.91% <ø> (ø)
Files Coverage Δ
tasks/__init__.py 100.00% <100.00%> (ø)
tasks/sync_repo_languages_gql.py 100.00% <100.00%> (ø)
tasks/sync_repos.py 96.48% <100.00%> (+0.07%) ⬆️
tasks/tests/unit/test_sync_repo_languages_gql.py 100.00% <100.00%> (ø)
tasks/tests/unit/test_sync_repos_task.py 99.17% <100.00%> (-0.55%) ⬇️

@adrian-codecov adrian-codecov merged commit df34150 into main Mar 18, 2024
29 of 30 checks passed
@adrian-codecov adrian-codecov deleted the 1348-add-gql-language-task branch March 18, 2024 17:43
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