mirror of
https://github.com/netinvent/npbackup.git
synced 2025-09-11 15:34:57 +08:00
!fixup Refactor processed_bytes metrics code, see #160
This commit is contained in:
parent
aa89cb04d5
commit
b51cc11d47
1 changed files with 7 additions and 2 deletions
|
@ -239,11 +239,16 @@ def restic_json_to_prometheus(
|
|||
backup_too_small = False
|
||||
try:
|
||||
if restic_json["total_bytes_processed"]:
|
||||
processed_bytes = BytesConverter(
|
||||
# We need human iec bytes for normalization accross other values
|
||||
processed_bytes_iec = BytesConverter(
|
||||
str(restic_json["total_bytes_processed"])
|
||||
).human_iec_bytes
|
||||
logger.info(f"Processed {processed_bytes} of data")
|
||||
logger.info(f"Processed {processed_bytes_iec} of data")
|
||||
if minimum_backup_size_error:
|
||||
# We need bytes for litteral comparison
|
||||
processed_bytes = BytesConverter(
|
||||
str(restic_json["total_bytes_processed"])
|
||||
).bytes
|
||||
if processed_bytes < int(
|
||||
BytesConverter(
|
||||
str(minimum_backup_size_error).replace(" ", "")
|
||||
|
|
Loading…
Add table
Reference in a new issue