Uploaded image for project: 'Cost Management'
  1. Cost Management
  2. COST-5531

QE - Storage unattributed cost is off for each cluster when more than one OCP on aws cluster are ingested

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • 2024Q3, 2024-Sep-27
    • None
    • None
    • None

      Reproducer:

      Fetch the testing MR

      (Optional)
      Modify the fixture 
      cost_get_aws_managed_disks
      like bellow to get always the same disk size
      If you don't do this, every run will pick a differnt size

      aws_managed_disk_one_candidates = [
      #(11, "st1"),
      #(12, "sc1"),
      (16, "sc1"),
      #(32, "io1"),
      #(64, "gp3"),
      #(256, "io2"),
      ]

      Run the following test with a breakpoint:

      ENV_FOR_DYNACONF=local iqe tests plugin cost_management --trace  -k 'test_api_ocp_on_aws_csi_storage_raw_calc' -raA

      THis test will ingest an OCP on AWS cluster named test_cost_ocp_on_aws

      Grab the unattributed cost

      http://localhost:8000/api/cost-management/v1/reports/openshift/volumes/?group_by[project]=*&filter[resolution]=monthly&filter[time_scope_value]=-2&filter[time_scope_units]=month&filter[cluster]=test_cost_ocp_on_aws

       
      value": 62.33726785258596
      Trino disk capacity:

      vol-aws_single_source_disk_one |       16 | 2024-08-14 00:00:00.000 | 499d5a1c-57fb-4f53-aa89-98b759d8e462 | 2024 | 08


      The test will pass

      Now run the test:

      ENV_FOR_DYNACONF=local iqe tests plugin cost_management --trace  -k 'test_api_ocp_on_aws_csi_storage_shared_disk_raw_calc' -raA

      This test will ingest 3 OCP on AWS clusters, 2 of them with unatributed storage project:
      test_cost_ocp_on_aws
      and test_cost_ocp_charlie

      Grab the same cost than before

      http://localhost:8000/api/cost-management/v1/reports/openshift/volumes/?group_by[project]=*&filter[resolution]=monthly&filter[time_scope_value]=-2&filter[time_scope_units]=month&filter[cluster]=test_cost_ocp_on_aws

      "value": 41.55817856839064

      Trino disk Capacity:

       vol-aws_single_source_disk_one |       16 | 2024-08-01 00:00:00.000 | bf37e7bd-1edf-4d30-ae49-51f9279c9c4d | 2024 | 08 

      The UUID is differnt because they are differnt sources, recreated

      The cost for the other cluster is off, too

      http://localhost:8000/api/cost-management/v1/reports/openshift/infrastructures/aws/storage/?group_by[project]=*&filter[resolution]=monthly&filter[time_scope_value]=-2&filter[time_scope_units]=month&filter[cluster]=test_cost_ocp_charlie

      Storage unattributed =  1232.000000  vs the expected 1612.000000027125  


      My guess is that when calculating the unattributed cost, each cluster is not picking up the correct dik size in the trino table


       

              rh-ee-plopezpe Pedro Lopez Perez
              rh-ee-plopezpe Pedro Lopez Perez
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: