-
Notifications
You must be signed in to change notification settings - Fork 94
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
[COST-5728] switch OCP on AWS endpoints to use amortized costs #5393
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5393 +/- ##
=======================================
- Coverage 94.1% 94.1% -0.0%
=======================================
Files 371 371
Lines 31549 31549
Branches 3385 3385
=======================================
- Hits 29689 29683 -6
- Misses 1204 1208 +4
- Partials 656 658 +2
|
/retest |
I tested this PR and the fix looks good to me! |
1cab137
to
80bca7b
Compare
myersCody
approved these changes
Nov 22, 2024
/retest |
/retest |
/retest |
1 similar comment
/retest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira Ticket
COST-5728
Description
This change will switch to amortised cost for the OCP back populate and OCP on ALL tables instead of a coalesce on unblended and savings plans. This is because when we insert into the trino temp tables we normalise all the savings plan and usage costs into a single line. The problem here is we then lose the additional unblended cost from the total value.
lineitem_usagestartdate | coalecse_cost | savingplan_cost | unblended_cost | blended_cost | calculated_amortized_cost | lineitem_lineitemtype
-------------------------+---------------+-----------------+----------------+--------------+---------------------------+-------------------------
2024-11-21 00:00:00.000 | 20.0 | 20.0 | 0.0 | 0.0 | 20.0 | SavingsPlanCoveredUsage
2024-11-21 00:00:00.000 | 10.0 | 0.0 | 10.0 | 10.0 | 10.0 | Usage
(2 rows)
Query 20241121_225310_00541_pvfbe, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
0.25 [2 rows, 28.2KiB] [8 rows/s, 114KiB/s]
trino:org1234567> select usage_amount, unblended_cost, savingsplan_effective_cost, calculated_amortized_cost from aws_openshift_daily_resource_matched_temp;
usage_amount | unblended_cost | savingsplan_effective_cost | calculated_amortized_cost
--------------+----------------+----------------------------+---------------------------
11.0 | 10.0 | 20.0 | 30.0
(1 row)
Essentially if we did the coalesce here like
sum(coalesce(nullif(savingsplan_effective_cost, 0), unblended_cost)) as unblended_cost
this would only work if these lineitemtypes stayed intact. But since we condense them before getting to this sql the coalesce only collects the savings plan cost meaning we DONT account for the additional $10 unblended cost which we should. Switching to amortised here works because in the same trino sql we correctly account for both unblended and savings plan costs before those lines are condensed into a single row.This is found when you have usage above your savings plan covered usage for the same resource id in a particular day.
Testing
Release Notes