-
Bug
-
Resolution: Done
-
Normal
-
None
-
None
-
None
-
5
-
False
-
None
-
False
-
-
While investigating/fixing COST-5728, we noticed that in case of savings plan items we insert an incorrect markup cost into OCP on ALL tables.
OCP on ALL view is supposed to use calculated_amortized_cost as an AWS infra cost and thus we should also apply corresponding markup cost, which is markup_cost_amortized. However, in OCP On All SQL queries we insert sum of markup_cost and sum of project_markup_cost respectively:
Here's an example of savings plan item from reporting_ocpawscostlineitem_project_daily_summary_p (this table is used as a source in OCP on all SQL queries)
product_code | AmazonEC2 product_family | Compute Instance ... shortened ... unblended_cost | 0.000000000000000 markup_cost | 0.000000000000000 project_markup_cost | 0.000000000000000 pod_cost | 0.000000000000000 blended_cost | 0.000000000000000 markup_cost_blended | 0.000000000000000 markup_cost_savingsplan | 0.300000000000000 markup_cost_amortized | 0.300000000 savingsplan_effective_cost | 3.000000000000000 calculated_amortized_cost | 3.000000000
We can see that both markup_cost and project_markup_cost, which are inserted into OCP on ALL tables, are $0 (they are calculated from unblended_cost) -> in fact we do not apply markup to these items. I believe the OCP on ALL queries should use markup_cost_amortized, which is derived from calculated_amortized_cost ($0.3 in the example above).
Additionally, we should also double check if pod_cost is calculated correctly here:
Steps to reproduce:
iqe branch: https://gitlab.cee.redhat.com/insights-qe/iqe-cost-management-plugin/-/merge_requests/2158/diffs
1. run
ENV_FOR_DYNACONF=local iqe tests plugin cost_management -k "ocp_on_aws_markup_calculation" -vv --pdb
2. wait for the test to fail