[#9999] writecache: Add IO tag label to metrics
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
81746f33e3
commit
2e8bc23292
7 changed files with 29 additions and 24 deletions
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
type WriteCacheMetrics interface {
|
||||
AddMethodDuration(shardID, path, storageType, method string, success bool, d time.Duration)
|
||||
AddMethodDuration(shardID, path, storageType, method string, success bool, d time.Duration, ioTag string)
|
||||
SetActualCount(shardID, path, storageType string, count uint64)
|
||||
SetEstimateSize(shardID, path, storageType string, size uint64)
|
||||
SetMode(shardID, mode string)
|
||||
|
@ -35,7 +35,7 @@ func newWriteCacheMetrics() *writeCacheMetrics {
|
|||
Subsystem: writeCacheSubsystem,
|
||||
Name: "request_duration_seconds",
|
||||
Help: "Writecache request process duration",
|
||||
}, []string{shardIDLabel, successLabel, storageLabel, methodLabel, pathLabel}),
|
||||
}, []string{shardIDLabel, successLabel, storageLabel, methodLabel, pathLabel, ioTagLabel}),
|
||||
operationCounter: metrics.NewCounterVec(prometheus.CounterOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: writeCacheSubsystem,
|
||||
|
@ -48,7 +48,7 @@ func newWriteCacheMetrics() *writeCacheMetrics {
|
|||
}
|
||||
}
|
||||
|
||||
func (m *writeCacheMetrics) AddMethodDuration(shardID, path, storageType, method string, success bool, d time.Duration) {
|
||||
func (m *writeCacheMetrics) AddMethodDuration(shardID, path, storageType, method string, success bool, d time.Duration, ioTag string) {
|
||||
m.methodDuration.With(
|
||||
prometheus.Labels{
|
||||
shardIDLabel: shardID,
|
||||
|
@ -56,6 +56,7 @@ func (m *writeCacheMetrics) AddMethodDuration(shardID, path, storageType, method
|
|||
storageLabel: storageType,
|
||||
methodLabel: method,
|
||||
pathLabel: path,
|
||||
ioTagLabel: ioTag,
|
||||
},
|
||||
).Observe(d.Seconds())
|
||||
}
|
||||
|
|
|
@ -80,12 +80,13 @@ func (noopMetrics) SetEvacuationInProgress(string, bool) {}
|
|||
func (noopMetrics) WriteCache() WriteCacheMetrics { return noopWriteCacheMetrics{} }
|
||||
func (noopMetrics) GC() GCMetrics { return noopGCMetrics{} }
|
||||
|
||||
func (noopWriteCacheMetrics) AddMethodDuration(string, string, string, string, bool, time.Duration) {}
|
||||
func (noopWriteCacheMetrics) SetActualCount(string, string, string, uint64) {}
|
||||
func (noopWriteCacheMetrics) SetEstimateSize(string, string, string, uint64) {}
|
||||
func (noopWriteCacheMetrics) SetMode(string, string) {}
|
||||
func (noopWriteCacheMetrics) IncOperationCounter(string, string, string, string, metrics.NullBool) {}
|
||||
func (noopWriteCacheMetrics) Close(string, string) {}
|
||||
func (noopWriteCacheMetrics) AddMethodDuration(string, string, string, string, bool, time.Duration, string) {
|
||||
}
|
||||
func (noopWriteCacheMetrics) SetActualCount(string, string, string, uint64) {}
|
||||
func (noopWriteCacheMetrics) SetEstimateSize(string, string, string, uint64) {}
|
||||
func (noopWriteCacheMetrics) SetMode(string, string) {}
|
||||
func (noopWriteCacheMetrics) IncOperationCounter(string, string, string, string, metrics.NullBool) {}
|
||||
func (noopWriteCacheMetrics) Close(string, string) {}
|
||||
|
||||
func (noopGCMetrics) AddRunDuration(string, time.Duration, bool) {}
|
||||
func (noopGCMetrics) AddDeletedCount(string, uint64, uint64) {}
|
||||
|
|
|
@ -157,16 +157,16 @@ func (m *writeCacheMetrics) SetShardID(id string) {
|
|||
m.shardID = id
|
||||
}
|
||||
|
||||
func (m *writeCacheMetrics) Get(d time.Duration, success bool, st writecache.StorageType) {
|
||||
m.metrics.AddMethodDuration(m.shardID, m.path, st.String(), "Get", success, d)
|
||||
func (m *writeCacheMetrics) Get(d time.Duration, success bool, st writecache.StorageType, ioTag string) {
|
||||
m.metrics.AddMethodDuration(m.shardID, m.path, st.String(), "Get", success, d, ioTag)
|
||||
}
|
||||
|
||||
func (m *writeCacheMetrics) Delete(d time.Duration, success bool, st writecache.StorageType) {
|
||||
m.metrics.AddMethodDuration(m.shardID, m.path, st.String(), "Delete", success, d)
|
||||
func (m *writeCacheMetrics) Delete(d time.Duration, success bool, st writecache.StorageType, ioTag string) {
|
||||
m.metrics.AddMethodDuration(m.shardID, m.path, st.String(), "Delete", success, d, ioTag)
|
||||
}
|
||||
|
||||
func (m *writeCacheMetrics) Put(d time.Duration, success bool, st writecache.StorageType) {
|
||||
m.metrics.AddMethodDuration(m.shardID, m.path, st.String(), "Put", success, d)
|
||||
func (m *writeCacheMetrics) Put(d time.Duration, success bool, st writecache.StorageType, ioTag string) {
|
||||
m.metrics.AddMethodDuration(m.shardID, m.path, st.String(), "Put", success, d, ioTag)
|
||||
}
|
||||
|
||||
func (m *writeCacheMetrics) SetEstimateSize(size uint64) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||
storagelog "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/log"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
|
||||
|
@ -29,7 +30,7 @@ func (c *cache) Delete(ctx context.Context, addr oid.Address) error {
|
|||
storageType := StorageTypeUndefined
|
||||
startedAt := time.Now()
|
||||
defer func() {
|
||||
c.metrics.Delete(time.Since(startedAt), deleted, storageType)
|
||||
c.metrics.Delete(time.Since(startedAt), deleted, storageType, qos.IOTagStringFromContext(ctx))
|
||||
}()
|
||||
|
||||
if !c.modeMtx.TryRLock() {
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
|
||||
|
@ -46,7 +47,7 @@ func (c *cache) getInternal(ctx context.Context, addr oid.Address) (*objectSDK.O
|
|||
storageType := StorageTypeUndefined
|
||||
startedAt := time.Now()
|
||||
defer func() {
|
||||
c.metrics.Get(time.Since(startedAt), found, storageType)
|
||||
c.metrics.Get(time.Since(startedAt), found, storageType, qos.IOTagStringFromContext(ctx))
|
||||
}()
|
||||
|
||||
res, err := c.fsTree.Get(ctx, common.GetPrm{Address: addr})
|
||||
|
|
|
@ -20,9 +20,9 @@ const (
|
|||
|
||||
type Metrics interface {
|
||||
SetShardID(string)
|
||||
Get(d time.Duration, success bool, st StorageType)
|
||||
Delete(d time.Duration, success bool, st StorageType)
|
||||
Put(d time.Duration, success bool, st StorageType)
|
||||
Get(d time.Duration, success bool, st StorageType, ioTag string)
|
||||
Delete(d time.Duration, success bool, st StorageType, ioTag string)
|
||||
Put(d time.Duration, success bool, st StorageType, ioTag string)
|
||||
Flush(success bool, st StorageType)
|
||||
Evict(st StorageType)
|
||||
|
||||
|
@ -41,11 +41,11 @@ func (metricsStub) SetShardID(string) {}
|
|||
|
||||
func (metricsStub) SetPath(string) {}
|
||||
|
||||
func (metricsStub) Get(time.Duration, bool, StorageType) {}
|
||||
func (metricsStub) Get(time.Duration, bool, StorageType, string) {}
|
||||
|
||||
func (metricsStub) Delete(time.Duration, bool, StorageType) {}
|
||||
func (metricsStub) Delete(time.Duration, bool, StorageType, string) {}
|
||||
|
||||
func (metricsStub) Put(time.Duration, bool, StorageType) {}
|
||||
func (metricsStub) Put(time.Duration, bool, StorageType, string) {}
|
||||
|
||||
func (metricsStub) SetEstimateSize(uint64) {}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||
storagelog "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/log"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
|
||||
|
@ -30,7 +31,7 @@ func (c *cache) Put(ctx context.Context, prm common.PutPrm) (common.PutRes, erro
|
|||
added := false
|
||||
storageType := StorageTypeUndefined
|
||||
defer func() {
|
||||
c.metrics.Put(time.Since(startedAt), added, storageType)
|
||||
c.metrics.Put(time.Since(startedAt), added, storageType, qos.IOTagStringFromContext(ctx))
|
||||
}()
|
||||
|
||||
if !c.modeMtx.TryRLock() {
|
||||
|
|
Loading…
Add table
Reference in a new issue