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: Routing report and comparisons #447

Merged
merged 4 commits into from
Dec 5, 2024

Conversation

JerrySentry
Copy link
Contributor

@JerrySentry JerrySentry commented Dec 4, 2024

  • Adds a BundleRouteReport to retrieve total size of each route to enable comparisons
  • Adds a BundleRoutesComparison to do comparisons between base and head BundleRouteReports. This will be used by PR comments.

closes: codecov/engineering-team#3032

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 marked this pull request as ready for review December 4, 2024 21:45
Copy link
Contributor

@suejung-sentry suejung-sentry left a comment

Choose a reason for hiding this comment

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

cool stuff!

self.db_path = db_path
self.data = data

def get_size(self) -> Dict[str, int]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on renaming like get_sizes_by_route or something to represent that you are fetching a map of routeToSize instead of just 1 size? Or like get_sizes?
Mentioning because I did a double take in above when something singular sounding was returning something plural
base_sizes = self.base_report.get_size()

results[route] = sum([asset.size for asset in asset_reports])
return results

def get_size_by_route(self, route: str) -> Optional[int]:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can consider dropping "by_route" in the function name since the argument route already communicates that context
but not sure if that's just a python thing where input args aren't so obvious so we need to help humans more

imported Assets into the belonging route. Also this function returns a
BundleRouteReport object as this will be used for comparison and additional
data manipulation.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

neat!

all_routes, results = base_sizes.keys() | head_sizes.keys(), []
for route_name in all_routes:
# Added new route
if route_name not in base_sizes:
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 need to add the case where base_sizes[route_name] is 0 to avoid a potential divide by 0 issue at line 240? Can 0 even happen - maybe with rounding?

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.01%. Comparing base (45252f7) to head (70113c1).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #447      +/-   ##
==========================================
- Coverage   90.66%   90.01%   -0.66%     
==========================================
  Files         397      324      -73     
  Lines       12230     9300    -2930     
  Branches     2069     1663     -406     
==========================================
- Hits        11088     8371    -2717     
+ Misses       1046      865     -181     
+ Partials       96       64      -32     
Flag Coverage Δ
shared-docker-uploader ?

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 added this pull request to the merge queue Dec 5, 2024
Merged via the queue into main with commit 130c885 Dec 5, 2024
6 checks passed
@JerrySentry JerrySentry deleted the dec_03_ba_route_fetch_compare branch December 5, 2024 16:06
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.

[Shared] Create Bundle Route Report and Comparison class
2 participants