diff --git a/src/cloudforet/cost_analysis/manager/cost_manager.py b/src/cloudforet/cost_analysis/manager/cost_manager.py index 6e9f085..1972550 100644 --- a/src/cloudforet/cost_analysis/manager/cost_manager.py +++ b/src/cloudforet/cost_analysis/manager/cost_manager.py @@ -36,6 +36,7 @@ def get_data(self, options, secret_data, schema, task_options): for idx, tenant_id in enumerate(tenant_ids): scope = self._make_scope(secret_data, task_options, collect_scope, tenant_id) blobs = self.azure_cm_connector.begin_create_operation(scope, parameters) + response_stream = self.azure_cm_connector.get_cost_data(blobs) for results in response_stream: yield self._make_cost_data(results=results, end=_end, tenant_id=tenant_id, options=options) @@ -53,9 +54,6 @@ def _make_cost_data(self, results, end, options, tenant_id=None): for result in results: result = {key.lower(): value for key, value in result.items()} - if result.get('invoiceid') is None: - continue - billed_date = self._set_billed_date(result.get('date', end)) if not billed_date: continue @@ -75,7 +73,7 @@ def _make_data_info(self, result, billed_date, options, tenant_id=None): usage_quantity = self._convert_str_to_float_format(result.get('quantity', 0)) usage_type = result.get('metername', '') usage_unit = result.get('unitofmeasure', '') - region_code = result.get('resourcelocation', '').lower() + region_code = result.get('resourcelocation', '') product = result.get('metercategory', '') tags = self._convert_tags_str_to_dict(result.get('tags', {})) @@ -150,6 +148,9 @@ def _get_additional_info(self, result, options, tenant_id=None): if result.get('customername') != '' and result.get('customername'): additional_info['Customer Name'] = result['customername'] + if result.get('servicefamily') != '' and result.get('servicefamily'): + additional_info['Service Family'] = result['servicefamily'] + return additional_info @staticmethod