project-koku / masu

This is a READ ONLY repo. See https://github.com/project-koku/koku for current masu implementation
GNU Affero General Public License v3.0
5 stars 6 forks source link

Rate calculations must incorporate cluster/provider #383

Closed chambridge closed 5 years ago

chambridge commented 5 years ago

Describe the bug Add an OpenShift cluster and define rates for derived cost. Receive usage data and calculate derived cost. Add a second OpenShift cluster that has overlapping project names. Do not define rates. Trigger summarization and koku will show 0 derived cost for projects.

Expected behavior I would expect project derived cost to be a summation across clusters if they share the same name. In the above scenario, the derived cost should show the amounts from the first cluster.

lcouzens commented 5 years ago

Right so I was seeing this too. Here's some snippets and how to reproduce it if it's not clear.

  1. Add two OCP providers
  2. Add rates to one provider
  3. Ingest data
  4. Hit 'v1/reports/openshift/compute/?group_by[cluster]=*&filter[resolution]=monthly' We should see both clusters, one with calculated charges from the provider rates and the other should have no charge value as the provider has no rates added.

Rates added to provider 1

 {
            "uuid": "1ff5cdb2-fd33-4c66-9140-2d0828809596",
            "provider_uuid": "598321ab-04a5-4996-9b48-c45ed2fe4da2",
            "metric": "cpu_core_usage_per_hour",
            "tiered_rate": [
                {
                    "unit": "USD",
                    "value": 0.2,
                    "usage_end": null,
                    "usage_start": null
                }
            ]
        },
        {
            "uuid": "26cb926e-80bb-4cb9-8dc0-f265e3e13479",
            "provider_uuid": "598321ab-04a5-4996-9b48-c45ed2fe4da2",
            "metric": "cpu_core_request_per_hour",
            "tiered_rate": [
                {
                    "unit": "USD",
                    "value": 0.2,
                    "usage_end": null,
                    "usage_start": null
                }
            ]
        }
 {
                    "cluster": "test-ocp-without-rates",
                    "values": [
                        {
                            "date": "2019-02",
                            "cluster": "test-ocp-without-rates",
                            "usage": 3384.0,
                            "request": 4320.0,
                            "limit": 4320.0,
                            "capacity": 864.0,
                            "charge": 1540.8,
                            "units": "Core-Hours",
                            "cluster_alias": "test-ocp-without-rates"
                        }
                    ]
                },
                {
                    "cluster": "provider_with_rates",
                    "values": [
                        {
                            "date": "2019-02",
                            "cluster": "provider_with_rates",
                            "usage": 3384.0,
                            "request": 4320.0,
                            "limit": 4320.0,
                            "capacity": 864.0,
                            "charge": 1540.8,
                            "units": "Core-Hours",
                            "cluster_alias": "provider_with_rates"
                        }
lcouzens commented 5 years ago

Verified Commit: dd866691f654b4b4ffe91ad751b3db980946303c