From c3cae160b35d53056e454386c09850a158c049ec Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 22 Mar 2021 21:27:01 +0100 Subject: [PATCH] mirror: Add total_s3uploaded_bytes metric (#3646) The new metric will track the total bytes of copied objects in the target during mirroring. --- cmd/mirror-main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index 53ccbb3c..4bbd45a8 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -204,6 +204,10 @@ var ( Name: "mc_mirror_total_s3ops", Help: "The total number of failed mirror events", }) + s3mirrorTotalUploadedBytes = promauto.NewCounter(prometheus.CounterOpts{ + Name: "mc_mirror_total_s3uploaded_bytes", + Help: "The total number of bytes uploaded by mirror", + }) s3mirrorFailedOps = promauto.NewCounter(prometheus.CounterOpts{ Name: "mc_mirror_failed_s3ops", Help: "The total number of failed mirror events", @@ -473,6 +477,7 @@ func (mj *mirrorJob) monitorMirrorStatus() (errDuringMirror bool) { } if sURLs.SourceContent != nil { + s3mirrorTotalUploadedBytes.Add(float64(sURLs.SourceContent.Size)) } else if sURLs.TargetContent != nil { // Construct user facing message and path. targetPath := filepath.ToSlash(filepath.Join(sURLs.TargetAlias, sURLs.TargetContent.URL.Path))