Dmitrii Stepanov
81ea91de52
`metrics` don't look like something others want to import. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
69 lines
2 KiB
Go
69 lines
2 KiB
Go
package metrics
|
|
|
|
import (
|
|
"time"
|
|
|
|
metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/internal/metrics"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor"
|
|
)
|
|
|
|
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)
|
|
}
|
|
}
|
|
|
|
func (m *blobstoreMetrics) ObjectsCount(d time.Duration, success bool) {
|
|
m.m.MethodDuration(m.shardID, "ObjectsCount", d, success, metrics_impl.NullBool{})
|
|
}
|