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

Bundle analysis: create timeseries dataset upon upload #601

Merged
merged 5 commits into from
Jun 10, 2024

Conversation

JerrySentry
Copy link
Contributor

@JerrySentry JerrySentry commented Jun 4, 2024

When the upload bundle stat file is called, we will create the supported datasets for trend data. When there's values in Dataset model, measurements will be able to start populating during processing of the stat file (this will be implemented next in the worker repo). This means that for BA there will not be a opt-in feature similar to flags/component trends, all users will be automatically opted in for this. Additionally there will not be a "backfilling" process for past bundle stats.

closes codecov/engineering-team#1771

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-qa
Copy link

codecov-qa bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.49%. Comparing base (0ee2d5c) to head (8907367).

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main     #601   +/-   ##
=======================================
  Coverage   91.49%   91.49%           
=======================================
  Files         615      615           
  Lines       16371    16379    +8     
=======================================
+ Hits        14978    14986    +8     
  Misses       1393     1393           
Flag Coverage Δ
unit 91.49% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 91.49% <100.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
upload/views/bundle_analysis.py 98.68% <100.00%> (+0.15%) ⬆️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@codecov-notifications
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link

codecov-public-qa bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.49%. Comparing base (0ee2d5c) to head (8907367).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #601   +/-   ##
=======================================
  Coverage   91.49%   91.49%           
=======================================
  Files         615      615           
  Lines       16371    16379    +8     
=======================================
+ Hits        14978    14986    +8     
  Misses       1393     1393           
Flag Coverage Δ
unit 91.49% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 91.49% <100.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
upload/views/bundle_analysis.py 98.68% <100.00%> (+0.15%) ⬆️

Impacted file tree graph

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.93%. Comparing base (0ee2d5c) to head (8907367).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@               Coverage Diff                @@
##               main       #601        +/-   ##
================================================
+ Coverage   95.92000   95.93000   +0.01000     
================================================
  Files           793        793                
  Lines         17689      17697         +8     
================================================
+ Hits          16969      16977         +8     
  Misses          720        720                
Flag Coverage Δ
unit 91.49% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 91.49% <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 marked this pull request as ready for review June 4, 2024 17:26
@JerrySentry JerrySentry requested a review from a team as a code owner June 4, 2024 17:26
@@ -142,4 +144,29 @@ def post(self, request):
is_shelter_request=self.is_shelter_request(),
),
)

if settings.TIMESERIES_ENABLED:
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 want to jump right to creating or do we want to create if it doesn't already exist / isn't backfilled? the latter is what is done for coverage i think

dataset = Dataset.objects.filter(
name=MeasurementName.COVERAGE.value,
repository_id=repository.pk,
).first()
if settings.TIMESERIES_ENABLED and dataset and dataset.is_backfilled():
# timeseries data is ready
return coverage_measurements(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think its better to create it as soon as possible then it is to create it when we fetch the measurements, that way we don't miss out on a datapoint in the general flow of upload->process->query since the process step is when we insert the measurement datapoints which relies on the presence of the dataset rows being inserted.

With the coverage measurements its ok because when querying and not having dataset created it can still compute and return measurements on the fly and then do a backfill. Also with BA we don't plan on doing backfills because the previous bundle schemas don't support it.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh on second read the code is get_or_create(), i thought it was just create(). my concern was that you would create multiple Datasets with the same type/repoID which sounded wrong. but this is all good



@pytest.mark.django_db(databases={"default", "timeseries"})
def test_upload_bundle_analysis_measurement_datasets_created(
Copy link
Contributor

Choose a reason for hiding this comment

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

jw, is it possible to parametrize this and the other test with the pytest.mark.parametrize() decorator?

@pytest.mark.parametrize("using_integration", [True, False])

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -142,4 +144,29 @@ def post(self, request):
is_shelter_request=self.is_shelter_request(),
),
)

if settings.TIMESERIES_ENABLED:
Copy link
Contributor

Choose a reason for hiding this comment

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

oh on second read the code is get_or_create(), i thought it was just create(). my concern was that you would create multiple Datasets with the same type/repoID which sounded wrong. but this is all good

@JerrySentry JerrySentry added this pull request to the merge queue Jun 10, 2024
Merged via the queue into main with commit bccac24 Jun 10, 2024
21 of 22 checks passed
@JerrySentry JerrySentry deleted the jun_04_ba_dataset branch June 10, 2024 18:10
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.

[API] Create Dataset object if not present during bundle uploading
3 participants