Unify replica client metrics

This commit is contained in:
Ben Johnson
2021-06-01 18:16:58 -06:00
parent 88909e3bd0
commit 1c0c69a5ab
5 changed files with 71 additions and 113 deletions

View File

@@ -4,6 +4,9 @@ import (
"io"
"os"
"syscall"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
// ReadCloser wraps a reader to also attach a separate closer.
@@ -123,3 +126,16 @@ func MkdirAll(path string, fi os.FileInfo) error {
_ = os.Chown(path, uid, gid)
return nil
}
// Shared replica metrics.
var (
OperationTotalCounterVec = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "litestream_replica_operation_total",
Help: "The number of replica operations performed",
}, []string{"replica_type", "operation"})
OperationBytesCounterVec = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "litestream_replica_operation_bytes",
Help: "The number of bytes used by replica operations",
}, []string{"replica_type", "operation"})
)