From 4c15c6f18facc3e52b5ce292f27583064355adec Mon Sep 17 00:00:00 2001 From: jinyoungmoonDEV Date: Wed, 15 Oct 2025 14:57:29 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B9=84=EC=9A=A9=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20Credit=20=EC=A0=95=EB=B3=B4=20=ED=8F=AC?= =?UTF-8?q?=ED=95=A8=20=EC=97=AC=EB=B6=80=EB=A5=BC=20optional=EB=A1=9C=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jinyoungmoonDEV --- src/plugin/manager/cost_manager.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugin/manager/cost_manager.py b/src/plugin/manager/cost_manager.py index 06d4710..d57e987 100644 --- a/src/plugin/manager/cost_manager.py +++ b/src/plugin/manager/cost_manager.py @@ -77,6 +77,8 @@ def get_data( date_ranges = self._get_date_range(start) + include_credit = options.get("include_credit", True) + for date in date_ranges: year, month = date.split("-") path = f"SPACE_ONE/billing/database={database}/account_id={account_id}/year={year}/month={month}" @@ -85,7 +87,7 @@ def get_data( for content in contents: response_stream = self.aws_s3_connector.get_cost_data(content["Key"]) for results in response_stream: - yield self._make_cost_data(results, account_id) + yield self._make_cost_data(results, account_id, include_credit) yield {"results": []} @@ -98,7 +100,7 @@ def _update_sync_state(self, options, secret_data, schema, service_account_id): tags["is_sync"] = "true" self.space_connector.update_service_account(service_account_id, tags) - def _make_cost_data(self, results, account_id): + def _make_cost_data(self, results, account_id, include_credit): costs_data = [] """ Source Data Model @@ -123,6 +125,10 @@ class CostSummaryItem(BaseModel): region = result["region"] or "USE1" service_code = result["service_code"] usage_type = result["usage_type"] + + if not include_credit and service_code == "Credit": + continue + data = { "cost": result.get("usage_cost", 0.0) or 0.0, "usage_quantity": result["usage_quantity"],