frostfs-node/pkg/local_object_storage/metrics/blobstore.go

66 lines
1.9 KiB
Go
Raw Permalink Normal View History

package metrics
import (
"time"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor"
metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/metrics"
)
type blobstoreMetrics struct {
shardID string
m metrics_impl.BlobstoreMetrics
}
func NewBlobstoreMetrics(m metrics_impl.BlobstoreMetrics) blobstor.Metrics {
return &blobstoreMetrics{
shardID: undefined,
m: m,
}
}
func (m *blobstoreMetrics) SetParentID(parentID string) {
m.shardID = parentID
}
func (m *blobstoreMetrics) SetMode(readOnly bool) {
m.m.SetMode(m.shardID, readOnly)
}
func (m *blobstoreMetrics) Close() {
m.m.Close(m.shardID)
}
func (m *blobstoreMetrics) Delete(d time.Duration, success, withStorageID bool) {
m.m.MethodDuration(m.shardID, "Delete", d, success, metrics_impl.NullBool{Bool: withStorageID, Valid: true})
}
func (m *blobstoreMetrics) Exists(d time.Duration, success, withStorageID bool) {
m.m.MethodDuration(m.shardID, "Exists", d, success, metrics_impl.NullBool{Bool: withStorageID, Valid: true})
}
func (m *blobstoreMetrics) GetRange(d time.Duration, size int, success, withStorageID bool) {
m.m.MethodDuration(m.shardID, "GetRange", d, success, metrics_impl.NullBool{Bool: withStorageID, Valid: true})
if success {
m.m.AddGet(m.shardID, size)
}
}
func (m *blobstoreMetrics) Get(d time.Duration, size int, success, withStorageID bool) {
m.m.MethodDuration(m.shardID, "Get", d, success, metrics_impl.NullBool{Bool: withStorageID, Valid: true})
if success {
m.m.AddGet(m.shardID, size)
}
}
func (m *blobstoreMetrics) Iterate(d time.Duration, success bool) {
m.m.MethodDuration(m.shardID, "Iterate", d, success, metrics_impl.NullBool{})
}
func (m *blobstoreMetrics) Put(d time.Duration, size int, success bool) {
m.m.MethodDuration(m.shardID, "Put", d, success, metrics_impl.NullBool{})
if success {
m.m.AddPut(m.shardID, size)
}
}