Skip to content

Commit d7b18c3

Browse files
authored
fix(sample) - Update soft_delete_window(seconds) from int to float in the soft delete relative cost analyzer. (GoogleCloudPlatform#11245)
* docs(samples): Updating readme for soft delete cost analyzer script * Updating the way of calculations Reviewed by team: cl/608673793 * Updating the comments * reformatting the comments * fix(sample) - Update seconds from int to float in the soft delete relative cost analyzer.
1 parent f93e2e0 commit d7b18c3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

storage/cost-analysis/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ NOTE: Due to the specific functionality related to Google Cloud APIs, this guide
2929
**Command-Line Arguments**
3030
* `project_name` - (**Required**): Specifies your GCP project name.
3131
* `--cost_threshold` - (Optional, default=0): Sets a relative cost threshold.
32-
* `--soft_delete_window` - (Optional, default= 604800 (i.e. 7 days)): Time window (in seconds) for considering soft-deleted objects..
32+
* `--soft_delete_window` - (Optional, default= 604800.0 (i.e. 7 days)): Time window (in seconds) for considering soft-deleted objects..
3333
* `--agg_days` - (Optional, default=30): The period over which to combine and aggregate results.
3434
* `--lookback_days` - (Optional, default=360): Time window (in days) for considering the how old the bucket to be.
3535
* `--list` - (Optional, default=False): Produces a simple list of bucket names.

storage/cost-analysis/storage_soft_delete_relative_cost_analyzer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_relative_cost(storage_class: str) -> float:
5757

5858
def get_soft_delete_cost(
5959
project_name: str,
60-
soft_delete_window: int,
60+
soft_delete_window: float,
6161
agg_days: int,
6262
lookback_days: int,
6363
) -> Dict[str, List[Dict[str, float]]]:
@@ -98,7 +98,7 @@ def get_soft_delete_cost(
9898
def calculate_soft_delete_costs(
9999
project_name: str,
100100
query_client: monitoring_client.QueryServiceClient,
101-
soft_delete_window: int,
101+
soft_delete_window: float,
102102
storage_ratios_by_bucket: Dict[str, float],
103103
agg_days: int,
104104
lookback_days: int,
@@ -234,7 +234,7 @@ def get_storage_class_ratio(
234234
def soft_delete_relative_cost_analyzer(
235235
project_name: str,
236236
cost_threshold: float = 0.0,
237-
soft_delete_window: int = 604800,
237+
soft_delete_window: float = 604800,
238238
agg_days: int = 30,
239239
lookback_days: int = 360,
240240
list_buckets: bool = False,
@@ -292,8 +292,8 @@ def soft_delete_relative_cost_analyzer_main() -> None:
292292
)
293293
parser.add_argument(
294294
"--soft_delete_window",
295-
type=int,
296-
default=604800,
295+
type=float,
296+
default=604800.0,
297297
help="Time window (in seconds) for considering soft-deleted objects.",
298298
)
299299
parser.add_argument(

0 commit comments

Comments
 (0)