Convert bytes to IEC bytes, fixes #143

This commit is contained in:
deajan 2025-02-28 14:48:36 +01:00
parent fc50f783ad
commit 9c9d131b1e
2 changed files with 3 additions and 3 deletions

View file

@ -159,7 +159,7 @@ def show_stats(statistics: List[dict]) -> None:
# --stats output
try:
total_size = BytesConverter(entry[repo_name]["output"]["total_size"]).human
total_size = BytesConverter(entry[repo_name]["output"]["total_size"]).human_iec_bytes
total_file_count = entry[repo_name]["output"]["total_file_count"]
snapshots_count = entry[repo_name]["output"]["snapshots_count"]
stats_type = "std"
@ -171,7 +171,7 @@ def show_stats(statistics: List[dict]) -> None:
pass
# --stats --mode raw-data output
try:
total_size = BytesConverter(entry[repo_name]["output"]["total_size"]).human
total_size = BytesConverter(entry[repo_name]["output"]["total_size"]).human_iec_bytes
total_uncompressed_size = BytesConverter(
entry[repo_name]["output"]["total_uncompressed_size"]
).human

View file

@ -236,7 +236,7 @@ def restic_json_to_prometheus(
try:
processed_bytes = BytesConverter(
str(restic_json["total_bytes_processed"])
).human
).human_iec_bytes
logger.info(f"Processed {processed_bytes} of data")
except Exception as exc:
logger.error(f"Cannot find processed bytes: {exc}")