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

[COST-4962] Populate OCP Network UI Summary Tables #5057

Merged
merged 5 commits into from
May 23, 2024

Conversation

cgoodfred
Copy link
Contributor

@cgoodfred cgoodfred commented Apr 22, 2024

Jira Ticket

COST-4962

Description

This change will populate the network summary tables for the UI to consume.

Testing

  1. There are two ways to test this as the summary SQL has not been merged in yet.
  • Option 1: merge in the changes from this PR ([COST-4744] Azure network data processing SQL #5056) and run summary so the daily summary table is filled first
  • Option 2: insert a few records for different days with expected criteria filled in. Here is an example of a record for an inbound network insertion.
INSERT INTO reporting_ocpusagelineitem_daily_summary (uuid, cluster_id, cluster_alias, data_source, namespace, node, resource_id, usage_start, usage_end, infrastructure_raw_cost, infrastructure_markup_cost, infrastructure_data_in_gigabytes, infrastructure_data_out_gigabytes, raw_currency, source_uuid, report_period_id, cost_category_id) VALUES('1c88cd37-9d56-407e-9262-ec1dea8dea06', 'my-ocp-cluster-1', 'TestCluster', 'Pod', 'Network unattributed', 'azure_compute1', 'azure_compute1', '2024-05-21', '2024-05-21', 10, 0, 100, NULL, 'USD', '2483a9ea-6cad-40ff-adc1-4f0acf819bc1', '1', NULL);
  1. After getting records in, run summary and check the newly filled tables.
  2. Some verification SQL for inbound records:
--baseline
postgres=# SELECT sum(infrastructure_data_in_gigabytes) as in, sum(infrastructure_raw_cost) as cost FROM reporting_ocpusagelineitem_daily_summary WHERE infrastructure_data_in_gigabytes > 0;
-[ RECORD 1 ]-------------
in   | 110.000000000000000
cost | 1.100000000000000

--network table
postgres=# SELECT sum(infrastructure_data_in_gigabytes) as in, sum(infrastructure_raw_cost) as cost FROM reporting_ocp_network_summary_p WHERE infrastructure_data_in_gigabytes > 0;
-[ RECORD 1 ]-------------
in   | 110.000000000000000
cost | 1.100000000000000

--network by node
postgres=# SELECT sum(infrastructure_data_in_gigabytes) as in, sum(infrastructure_raw_cost) as cost, node FROM repor
ting_ocp_network_summary_by_node_p WHERE infrastructure_data_in_gigabytes > 0 GROUP BY node;
-[ RECORD 1 ]-------------
in   | 110.000000000000000
cost | 1.100000000000000
node | azure_compute1

--network by project, for now will only have Network unattributed project
postgres=# SELECT sum(infrastructure_data_in_gigabytes) as in, sum(infrastructure_raw_cost) as cost, namespace FROM 
reporting_ocp_network_summary_by_project_p WHERE infrastructure_data_in_gigabytes > 0 GROUP BY namespace;
-[ RECORD 1 ]-------------------
in        | 110.000000000000000
cost      | 1.100000000000000
namespace | Network unattributed
  1. Some verification SQL for outbound records:
--baseline
postgres=# SELECT sum(infrastructure_data_out_gigabytes) as out, sum(infrastructure_raw_cost) as cost FROM reporting_ocpusagelineitem_daily_summary WHERE infrastructure_data_out_gigabytes > 0;
-[ RECORD 1 ]-------------
out   | 165.000000000000000
cost | 1.650000000000000

--network table
postgres=# SELECT sum(infrastructure_data_out_gigabytes) as out, sum(infrastructure_raw_cost) as cost FROM reporting_ocp_network_summary_p WHERE infrastructure_data_out_gigabytes > 0;
-[ RECORD 1 ]-------------
out  | 165.000000000000000
cost | 1.650000000000000

--network by node
postgres=# SELECT sum(infrastructure_data_out_gigabytes) as out, sum(infrastructure_raw_cost) as cost, node FROM reporting_ocp_network_summary_by_node_p WHERE infrastructure_data_out_gigabytes > 0 GROUP BY node;
-[ RECORD 1 ]-------------
out  | 165.000000000000000
cost | 1.650000000000000
node | azure_compute1

--network by project, for now will only have Network unattributed project
postgres=# SELECT sum(infrastructure_data_out_gigabytes) as out, sum(infrastructure_raw_cost) as cost, namespace FROM reporting_ocp_network_summary_by_project_p WHERE infrastructure_data_out_gigabytes > 0 GROUP BY namespace;
-[ RECORD 1 ]-------------------
out       | 165.000000000000000
cost      | 1.650000000000000
namespace | Network unattributed

Release Notes

  • proposed release note
* [COST-4962](https://issues.redhat.com/browse/COST-4962) Populate OCP Network UI Summary Tables during summary flow.

Copy link

codecov bot commented Apr 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.2%. Comparing base (ff7e502) to head (ac90435).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5057   +/-   ##
=====================================
  Coverage   94.2%   94.2%           
=====================================
  Files        378     378           
  Lines      31622   31622           
  Branches    3756    3756           
=====================================
+ Hits       29777   29780    +3     
+ Misses      1177    1174    -3     
  Partials     668     668           

@cgoodfred cgoodfred self-assigned this May 22, 2024
@cgoodfred cgoodfred added the smoke-tests pr_check will build the image and run minimal required smokes label May 22, 2024
@cgoodfred cgoodfred marked this pull request as ready for review May 22, 2024 15:04
@cgoodfred cgoodfred requested review from a team as code owners May 22, 2024 15:04
@cgoodfred cgoodfred merged commit 4b4c50a into main May 23, 2024
11 checks passed
@cgoodfred cgoodfred deleted the COST-4962-ocp-network-ui-summary branch May 23, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
smoke-tests pr_check will build the image and run minimal required smokes smokes-required
Projects
None yet
2 participants