mirror: Add total_s3uploaded_bytes metric (#3646)

The new metric will track the total bytes of copied objects in the
target during mirroring.
This commit is contained in:
Anis Elleuch
2021-03-22 13:27:01 -07:00
committed by GitHub
parent 1f71fdc03a
commit cc72657c97
+5
View File
@@ -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))