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

Prep the terrain for reports with label compression. #188

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

giovanni-guidini
Copy link
Contributor

context: codecov/engineering-team #768

Creates a rollout for label compression. This is gonna help us to test and safely release the feature in the wild.
Notice that currently the label compression does nothing.
There are comments similar to TODO: needs shared update.
The update in question is codecov/shared#79

So these changes mostly prep the terrain for future changes that will actually do something,
and add the guardrails to avoid issues when deploying.
In particular it adds some helper methods to the ArchiveService, creates a kinda-stubbed LabelsIndexService,
passes more data to the _adjust_sessions portion of raw_upload_processor where most changes will occur.

If you're curious as to what the end result will probably look like see #180

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.

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Merging #188 (bb537db) into main (8e60c86) will increase coverage by 0.01%.
The diff coverage is 100.00%.

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

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
+ Coverage   98.30%   98.31%   +0.01%     
==========================================
  Files         380      382       +2     
  Lines       28366    28489     +123     
==========================================
+ Hits        27886    28010     +124     
+ Misses        480      479       -1     
Flag Coverage Δ
integration 98.35% <100.00%> (+0.01%) ⬆️
latest-uploader-overall 98.35% <100.00%> (+0.01%) ⬆️
unit 98.35% <100.00%> (+0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.69% <100.00%> (+0.02%) ⬆️
OutsideTasks 98.15% <100.00%> (+0.01%) ⬆️
Files Coverage Δ
database/models/reports.py 99.20% <100.00%> (ø)
rollouts/__init__.py 100.00% <100.00%> (+14.28%) ⬆️
services/archive.py Critical 94.16% <100.00%> (+0.71%) ⬆️
services/report/__init__.py Critical 97.92% <ø> (ø)
services/report/labels_index.py 100.00% <100.00%> (ø)
services/report/raw_upload_processor.py 97.63% <100.00%> (+0.15%) ⬆️
services/report/tests/unit/test_labels_index.py 100.00% <100.00%> (ø)
services/report/tests/unit/test_sessions.py 100.00% <100.00%> (ø)
services/tests/unit/test_archive_service.py 100.00% <100.00%> (ø)

This change has been scanned for critical changes. Learn more

@codecov-staging
Copy link

codecov-staging bot commented Nov 21, 2023

Codecov Report

Merging #188 (bb537db) into main (8e60c86) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
+ Coverage   98.34%   98.35%   +0.01%     
==========================================
  Files         351      353       +2     
  Lines       27721    27844     +123     
==========================================
+ Hits        27262    27386     +124     
+ Misses        459      458       -1     
Flag Coverage Δ
integration 98.35% <100.00%> (+0.01%) ⬆️
latest-uploader-overall 98.35% <100.00%> (+0.01%) ⬆️
unit 98.35% <100.00%> (+0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.81% <100.00%> (+0.02%) ⬆️
OutsideTasks 98.15% <100.00%> (+0.01%) ⬆️
Files Coverage Δ
database/models/reports.py 99.20% <100.00%> (ø)
rollouts/__init__.py 100.00% <100.00%> (+14.28%) ⬆️
services/archive.py 94.11% <100.00%> (+0.72%) ⬆️
services/report/__init__.py 97.92% <ø> (ø)
services/report/labels_index.py 100.00% <100.00%> (ø)
services/report/raw_upload_processor.py 97.63% <100.00%> (+0.15%) ⬆️
services/report/tests/unit/test_labels_index.py 100.00% <100.00%> (ø)
services/report/tests/unit/test_sessions.py 100.00% <100.00%> (ø)
services/tests/unit/test_archive_service.py 100.00% <100.00%> (ø)

@codecov-qa
Copy link

codecov-qa bot commented Nov 21, 2023

Codecov Report

Merging #188 (bb537db) into main (8e60c86) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
+ Coverage   98.34%   98.35%   +0.01%     
==========================================
  Files         351      353       +2     
  Lines       27721    27844     +123     
==========================================
+ Hits        27262    27386     +124     
+ Misses        459      458       -1     
Flag Coverage Δ
integration 98.35% <100.00%> (+0.01%) ⬆️
latest-uploader-overall 98.35% <100.00%> (+0.01%) ⬆️
unit 98.35% <100.00%> (+0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 96.81% <100.00%> (+0.02%) ⬆️
OutsideTasks 98.15% <100.00%> (+0.01%) ⬆️
Files Coverage Δ
database/models/reports.py 99.20% <100.00%> (ø)
rollouts/__init__.py 100.00% <100.00%> (+14.28%) ⬆️
services/archive.py 94.11% <100.00%> (+0.72%) ⬆️
services/report/__init__.py 97.92% <ø> (ø)
services/report/labels_index.py 100.00% <100.00%> (ø)
services/report/raw_upload_processor.py 97.63% <100.00%> (+0.15%) ⬆️
services/report/tests/unit/test_labels_index.py 100.00% <100.00%> (ø)
services/report/tests/unit/test_sessions.py 100.00% <100.00%> (ø)
services/tests/unit/test_archive_service.py 100.00% <100.00%> (ø)

context: codecov/engineering-team #768

Creates a rollout for label compression. This is gonna help us to test and safely release the feature in the wild.
Notice that currently the label compression does nothing.
There are comments similar to `TODO: needs shared update`.
The update in question is codecov/shared#79

So these changes mostly prep the terrain for future changes that will actually do something,
and add the guardrails to avoid issues when deploying.
In particular it adds some helper methods to the `ArchiveService`, creates a kinda-stubbed `LabelsIndexService`,
passes more data to the `_adjust_sessions` portion of `raw_upload_processor` where most changes will occur.

If you're curious as to what the end result will probably look like see #180
):
label_index_service = LabelsIndexService(upload.report)
# TODO: Needs shared upload
# if original_report._labels_index is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

If _labels_index is meant to be accessed from the outside then maybe remove the leading _ (it's convention for private methods and attrs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fair... I'll change that in shared and adjust in the PR that actually makes use of it

# if original_report._labels_index is None:
# label_index_service.set_label_idx(original_report)
# # Make sure that the labels in the reports are in a good state to merge them
# make_sure_orginal_report_is_using_label_ids(original_report)
Copy link
Contributor

Choose a reason for hiding this comment

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

Where will these functions come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +35 to +43
def unset_label_idx(self, report: Report, label_index: Dict[str, str]):
# Write the updated index back into storage
# TODO: Needs shared update
# self._archive_client.write_label_index(
# self.commit_sha, report._labels_index, self.commit_report.code
# )
self._archive_client.write_label_index(
self.commit_sha, label_index, self.commit_report.code
)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is unsetting tied to writing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question... In my mind you take the index from storage into memory, possibly modify it, and once you're done with it expect it to be re-written to storage to preserve changes.

I see that it's not obvious though...

@giovanni-guidini giovanni-guidini merged commit f751090 into main Nov 29, 2023
25 of 26 checks passed
@giovanni-guidini giovanni-guidini deleted the gio/label-compressed/rollout branch November 29, 2023 12:28
scott-codecov added a commit that referenced this pull request Dec 6, 2023
* main:
  Only trigger AI PR review if pull is open
  Add log line when triggering AI PR review task
  fix: use original PR base to compute patch coverage (#199)
  Prepare release 23.12.4
  Update workflows
  chore(deps): Update codecov-shared dependency (#194)
  Prep the terrain for reports with label compression. (#188)
  allow staging deploy when pushing to staging (#192)
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.

3 participants