From 86897314d54f68164c9fee330deb9772b0f4f6fa Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Thu, 22 Feb 2024 22:17:54 +0100 Subject: [PATCH] backup: expose data_added_in_repo in JSON output The value describes how much data was added after compression. Previously, it was only available in the text output. --- doc/075_scripting.rst | 4 +++- internal/ui/backup/json.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/075_scripting.rst b/doc/075_scripting.rst index fda4b2d53..1c0f7a34f 100644 --- a/doc/075_scripting.rst +++ b/doc/075_scripting.rst @@ -163,7 +163,9 @@ Summary is the last output line in a successful backup. +---------------------------+---------------------------------------------------------+ | ``tree_blobs`` | Number of tree blobs | +---------------------------+---------------------------------------------------------+ -| ``data_added`` | Amount of data added, in bytes | +| ``data_added`` | Amount of (uncompressed) data added, in bytes | ++---------------------------+---------------------------------------------------------+ +| ``data_added_in_repo`` | Amount of data added (after compression), in bytes | +---------------------------+---------------------------------------------------------+ | ``total_files_processed`` | Total number of files processed | +---------------------------+---------------------------------------------------------+ diff --git a/internal/ui/backup/json.go b/internal/ui/backup/json.go index 3393a3d48..b3a8b44a7 100644 --- a/internal/ui/backup/json.go +++ b/internal/ui/backup/json.go @@ -175,6 +175,7 @@ func (b *JSONProgress) Finish(snapshotID restic.ID, start time.Time, summary *ar DataBlobs: summary.ItemStats.DataBlobs, TreeBlobs: summary.ItemStats.TreeBlobs, DataAdded: summary.ItemStats.DataSize + summary.ItemStats.TreeSize, + DataAddedInRepo: summary.ItemStats.DataSizeInRepo + summary.ItemStats.TreeSizeInRepo, TotalFilesProcessed: summary.Files.New + summary.Files.Changed + summary.Files.Unchanged, TotalBytesProcessed: summary.ProcessedBytes, TotalDuration: time.Since(start).Seconds(), @@ -230,6 +231,7 @@ type summaryOutput struct { DataBlobs int `json:"data_blobs"` TreeBlobs int `json:"tree_blobs"` DataAdded uint64 `json:"data_added"` + DataAddedInRepo uint64 `json:"data_added_in_repo"` TotalFilesProcessed uint `json:"total_files_processed"` TotalBytesProcessed uint64 `json:"total_bytes_processed"` TotalDuration float64 `json:"total_duration"` // in seconds