diff --git a/internal/metrics/metabase.go b/internal/metrics/metabase.go index 640c7f721..ee08f5545 100644 --- a/internal/metrics/metabase.go +++ b/internal/metrics/metabase.go @@ -12,7 +12,7 @@ type MetabaseMetrics interface { SetMode(shardID, path string, mode string) Close(shardID, path string) - MethodDuration(shardID, path string, method string, d time.Duration, success bool) + MethodDuration(shardID, path string, method string, d time.Duration, success bool, ioTag string) } func newMetabaseMetrics() *metabaseMetrics { @@ -23,7 +23,7 @@ func newMetabaseMetrics() *metabaseMetrics { Subsystem: metabaseSubSystem, Name: "request_duration_seconds", Help: "Accumulated Metabase request process duration", - }, []string{shardIDLabel, successLabel, pathLabel, methodLabel}), + }, []string{shardIDLabel, successLabel, pathLabel, methodLabel, ioTagLabel}), } } @@ -44,11 +44,12 @@ func (m *metabaseMetrics) Close(shardID, path string) { }) } -func (m *metabaseMetrics) MethodDuration(shardID, path string, method string, d time.Duration, success bool) { +func (m *metabaseMetrics) MethodDuration(shardID, path string, method string, d time.Duration, success bool, ioTag string) { m.reqDuration.With(prometheus.Labels{ shardIDLabel: shardID, pathLabel: path, successLabel: strconv.FormatBool(success), methodLabel: method, + ioTagLabel: ioTag, }).Observe(d.Seconds()) } diff --git a/pkg/local_object_storage/metabase/children.go b/pkg/local_object_storage/metabase/children.go index acd367951..b8b910f74 100644 --- a/pkg/local_object_storage/metabase/children.go +++ b/pkg/local_object_storage/metabase/children.go @@ -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/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -20,7 +21,7 @@ func (db *DB) GetChildren(ctx context.Context, addresses []oid.Address) (map[oid success = false ) defer func() { - db.metrics.AddMethodDuration("GetChildren", time.Since(startedAt), success) + db.metrics.AddMethodDuration("GetChildren", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.GetChildren", diff --git a/pkg/local_object_storage/metabase/containers.go b/pkg/local_object_storage/metabase/containers.go index da27e6085..75fb92ff6 100644 --- a/pkg/local_object_storage/metabase/containers.go +++ b/pkg/local_object_storage/metabase/containers.go @@ -5,6 +5,7 @@ import ( "encoding/binary" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" @@ -17,7 +18,7 @@ func (db *DB) Containers(ctx context.Context) (list []cid.ID, err error) { success = false ) defer func() { - db.metrics.AddMethodDuration("Containers", time.Since(startedAt), success) + db.metrics.AddMethodDuration("Containers", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.Containers") diff --git a/pkg/local_object_storage/metabase/counter.go b/pkg/local_object_storage/metabase/counter.go index 732f99519..17ad34e40 100644 --- a/pkg/local_object_storage/metabase/counter.go +++ b/pkg/local_object_storage/metabase/counter.go @@ -8,6 +8,7 @@ import ( "fmt" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" @@ -105,7 +106,7 @@ func (db *DB) ContainerCounters(ctx context.Context) (ContainerCounters, error) success = false ) defer func() { - db.metrics.AddMethodDuration("ContainerCounters", time.Since(startedAt), success) + db.metrics.AddMethodDuration("ContainerCounters", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() ctx, span := tracing.StartSpanFromContext(ctx, "metabase.ContainerCounters") @@ -200,7 +201,7 @@ func (db *DB) ContainerCount(ctx context.Context, id cid.ID) (ObjectCounters, er success = false ) defer func() { - db.metrics.AddMethodDuration("ContainerCount", time.Since(startedAt), success) + db.metrics.AddMethodDuration("ContainerCount", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.ContainerCount") @@ -544,7 +545,7 @@ func (db *DB) ZeroSizeContainers(ctx context.Context) ([]cid.ID, error) { success = false ) defer func() { - db.metrics.AddMethodDuration("ZeroSizeContainers", time.Since(startedAt), success) + db.metrics.AddMethodDuration("ZeroSizeContainers", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() ctx, span := tracing.StartSpanFromContext(ctx, "metabase.ZeroSizeContainers") @@ -634,7 +635,7 @@ func (db *DB) DeleteContainerSize(ctx context.Context, id cid.ID) error { success = false ) defer func() { - db.metrics.AddMethodDuration("DeleteContainerSize", time.Since(startedAt), success) + db.metrics.AddMethodDuration("DeleteContainerSize", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.DeleteContainerSize", @@ -672,7 +673,7 @@ func (db *DB) ZeroCountContainers(ctx context.Context) ([]cid.ID, error) { success = false ) defer func() { - db.metrics.AddMethodDuration("ZeroCountContainers", time.Since(startedAt), success) + db.metrics.AddMethodDuration("ZeroCountContainers", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() ctx, span := tracing.StartSpanFromContext(ctx, "metabase.ZeroCountContainers") @@ -717,7 +718,7 @@ func (db *DB) DeleteContainerCount(ctx context.Context, id cid.ID) error { success = false ) defer func() { - db.metrics.AddMethodDuration("DeleteContainerCount", time.Since(startedAt), success) + db.metrics.AddMethodDuration("DeleteContainerCount", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.DeleteContainerCount", diff --git a/pkg/local_object_storage/metabase/delete.go b/pkg/local_object_storage/metabase/delete.go index d338e228f..aa05d406f 100644 --- a/pkg/local_object_storage/metabase/delete.go +++ b/pkg/local_object_storage/metabase/delete.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" 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" @@ -89,7 +90,7 @@ func (db *DB) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, error) { deleted = false ) defer func() { - db.metrics.AddMethodDuration("Delete", time.Since(startedAt), deleted) + db.metrics.AddMethodDuration("Delete", time.Since(startedAt), deleted, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.Delete", diff --git a/pkg/local_object_storage/metabase/exists.go b/pkg/local_object_storage/metabase/exists.go index 962108a76..f9cfbf6b9 100644 --- a/pkg/local_object_storage/metabase/exists.go +++ b/pkg/local_object_storage/metabase/exists.go @@ -5,6 +5,7 @@ import ( "fmt" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" @@ -62,7 +63,7 @@ func (db *DB) Exists(ctx context.Context, prm ExistsPrm) (res ExistsRes, err err success = false ) defer func() { - db.metrics.AddMethodDuration("Exists", time.Since(startedAt), success) + db.metrics.AddMethodDuration("Exists", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.Exists", diff --git a/pkg/local_object_storage/metabase/expired.go b/pkg/local_object_storage/metabase/expired.go index 68144d8b1..a84c8c4fe 100644 --- a/pkg/local_object_storage/metabase/expired.go +++ b/pkg/local_object_storage/metabase/expired.go @@ -7,6 +7,7 @@ import ( "strconv" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" @@ -27,7 +28,7 @@ func (db *DB) FilterExpired(ctx context.Context, epoch uint64, addresses []oid.A success = true ) defer func() { - db.metrics.AddMethodDuration("FilterExpired", time.Since(startedAt), success) + db.metrics.AddMethodDuration("FilterExpired", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.FilterExpired", diff --git a/pkg/local_object_storage/metabase/get.go b/pkg/local_object_storage/metabase/get.go index 615add1af..271bdf416 100644 --- a/pkg/local_object_storage/metabase/get.go +++ b/pkg/local_object_storage/metabase/get.go @@ -5,6 +5,7 @@ import ( "fmt" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" @@ -58,7 +59,7 @@ func (db *DB) Get(ctx context.Context, prm GetPrm) (res GetRes, err error) { success = false ) defer func() { - db.metrics.AddMethodDuration("Get", time.Since(startedAt), success) + db.metrics.AddMethodDuration("Get", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.Get", diff --git a/pkg/local_object_storage/metabase/graveyard.go b/pkg/local_object_storage/metabase/graveyard.go index 2f23d424c..44c41cd1b 100644 --- a/pkg/local_object_storage/metabase/graveyard.go +++ b/pkg/local_object_storage/metabase/graveyard.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" @@ -68,7 +69,7 @@ func (db *DB) IterateOverGarbage(ctx context.Context, p GarbageIterationPrm) err success = false ) defer func() { - db.metrics.AddMethodDuration("IterateOverGarbage", time.Since(startedAt), success) + db.metrics.AddMethodDuration("IterateOverGarbage", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.IterateOverGarbage") @@ -148,7 +149,7 @@ func (db *DB) IterateOverGraveyard(ctx context.Context, p GraveyardIterationPrm) success = false ) defer func() { - db.metrics.AddMethodDuration("IterateOverGraveyard", time.Since(startedAt), success) + db.metrics.AddMethodDuration("IterateOverGraveyard", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.IterateOverGraveyard") @@ -266,7 +267,7 @@ func (db *DB) InhumeTombstones(ctx context.Context, tss []TombstonedObject) (Inh success = false ) defer func() { - db.metrics.AddMethodDuration("InhumeTombstones", time.Since(startedAt), success) + db.metrics.AddMethodDuration("InhumeTombstones", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.InhumeTombstones") diff --git a/pkg/local_object_storage/metabase/inhume.go b/pkg/local_object_storage/metabase/inhume.go index 76018fb61..6c0e888db 100644 --- a/pkg/local_object_storage/metabase/inhume.go +++ b/pkg/local_object_storage/metabase/inhume.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" 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" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" @@ -177,7 +178,7 @@ func (db *DB) Inhume(ctx context.Context, prm InhumePrm) (InhumeRes, error) { success = false ) defer func() { - db.metrics.AddMethodDuration("Inhume", time.Since(startedAt), success) + db.metrics.AddMethodDuration("Inhume", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.Inhume") defer span.End() diff --git a/pkg/local_object_storage/metabase/iterators.go b/pkg/local_object_storage/metabase/iterators.go index 9cccd7dad..195ec0f9f 100644 --- a/pkg/local_object_storage/metabase/iterators.go +++ b/pkg/local_object_storage/metabase/iterators.go @@ -6,6 +6,7 @@ import ( "strconv" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" @@ -53,7 +54,7 @@ func (db *DB) IterateExpired(ctx context.Context, epoch uint64, h ExpiredObjectH success = false ) defer func() { - db.metrics.AddMethodDuration("IterateExpired", time.Since(startedAt), success) + db.metrics.AddMethodDuration("IterateExpired", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.IterateExpired", trace.WithAttributes( diff --git a/pkg/local_object_storage/metabase/list.go b/pkg/local_object_storage/metabase/list.go index eaef3b9ba..81075766b 100644 --- a/pkg/local_object_storage/metabase/list.go +++ b/pkg/local_object_storage/metabase/list.go @@ -5,6 +5,7 @@ import ( "context" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" @@ -99,7 +100,7 @@ func (db *DB) ListWithCursor(ctx context.Context, prm ListPrm) (res ListRes, err success = false ) defer func() { - db.metrics.AddMethodDuration("ListWithCursor", time.Since(startedAt), success) + db.metrics.AddMethodDuration("ListWithCursor", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.ListWithCursor", trace.WithAttributes( @@ -300,7 +301,7 @@ func (db *DB) IterateOverContainers(ctx context.Context, prm IterateOverContaine success = false ) defer func() { - db.metrics.AddMethodDuration("IterateOverContainers", time.Since(startedAt), success) + db.metrics.AddMethodDuration("IterateOverContainers", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.IterateOverContainers", trace.WithAttributes( @@ -361,7 +362,7 @@ func (db *DB) IterateOverObjectsInContainer(ctx context.Context, prm IterateOver success = false ) defer func() { - db.metrics.AddMethodDuration("IterateOverObjectsInContainer", time.Since(startedAt), success) + db.metrics.AddMethodDuration("IterateOverObjectsInContainer", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.IterateOverObjectsInContainer", trace.WithAttributes( @@ -454,7 +455,7 @@ func (db *DB) CountAliveObjectsInContainer(ctx context.Context, prm CountAliveOb success = false ) defer func() { - db.metrics.AddMethodDuration("CountAliveObjectsInBucket", time.Since(startedAt), success) + db.metrics.AddMethodDuration("CountAliveObjectsInBucket", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.CountAliveObjectsInBucket") defer span.End() diff --git a/pkg/local_object_storage/metabase/lock.go b/pkg/local_object_storage/metabase/lock.go index b930a0141..c2d948a92 100644 --- a/pkg/local_object_storage/metabase/lock.go +++ b/pkg/local_object_storage/metabase/lock.go @@ -6,6 +6,7 @@ import ( "fmt" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" @@ -42,7 +43,7 @@ func (db *DB) Lock(ctx context.Context, cnr cid.ID, locker oid.ID, locked []oid. success = false ) defer func() { - db.metrics.AddMethodDuration("Lock", time.Since(startedAt), success) + db.metrics.AddMethodDuration("Lock", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.Lock", @@ -125,13 +126,13 @@ func (db *DB) lockInternal(locked []oid.ID, cnr cid.ID, locker oid.ID) error { // FreeLockedBy unlocks all objects in DB which are locked by lockers. // Returns slice of unlocked object ID's or an error. -func (db *DB) FreeLockedBy(lockers []oid.Address) ([]oid.Address, error) { +func (db *DB) FreeLockedBy(ctx context.Context, lockers []oid.Address) ([]oid.Address, error) { var ( startedAt = time.Now() success = false ) defer func() { - db.metrics.AddMethodDuration("FreeLockedBy", time.Since(startedAt), success) + db.metrics.AddMethodDuration("FreeLockedBy", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() db.modeMtx.RLock() @@ -328,7 +329,7 @@ func (db *DB) IsLocked(ctx context.Context, prm IsLockedPrm) (res IsLockedRes, e success = false ) defer func() { - db.metrics.AddMethodDuration("IsLocked", time.Since(startedAt), success) + db.metrics.AddMethodDuration("IsLocked", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.IsLocked", @@ -361,7 +362,7 @@ func (db *DB) GetLocks(ctx context.Context, addr oid.Address) (res []oid.ID, err success = false ) defer func() { - db.metrics.AddMethodDuration("GetLocks", time.Since(startedAt), success) + db.metrics.AddMethodDuration("GetLocks", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.GetLocks", diff --git a/pkg/local_object_storage/metabase/lock_test.go b/pkg/local_object_storage/metabase/lock_test.go index 341ff9ad1..dde27ef08 100644 --- a/pkg/local_object_storage/metabase/lock_test.go +++ b/pkg/local_object_storage/metabase/lock_test.go @@ -121,7 +121,7 @@ func TestDB_Lock(t *testing.T) { require.Len(t, res.DeletedLockObjects(), 1) require.Equal(t, objectcore.AddressOf(lockObj), res.DeletedLockObjects()[0]) - _, err = db.FreeLockedBy([]oid.Address{lockAddr}) + _, err = db.FreeLockedBy(context.Background(), []oid.Address{lockAddr}) require.NoError(t, err) inhumePrm.SetAddresses(objAddr) @@ -152,7 +152,7 @@ func TestDB_Lock(t *testing.T) { // unlock just objects that were locked by // just removed locker - _, err = db.FreeLockedBy([]oid.Address{res.DeletedLockObjects()[0]}) + _, err = db.FreeLockedBy(context.Background(), []oid.Address{res.DeletedLockObjects()[0]}) require.NoError(t, err) // removing objects after unlock diff --git a/pkg/local_object_storage/metabase/metrics.go b/pkg/local_object_storage/metabase/metrics.go index d673560c7..9982bbcaa 100644 --- a/pkg/local_object_storage/metabase/metrics.go +++ b/pkg/local_object_storage/metabase/metrics.go @@ -12,12 +12,12 @@ type Metrics interface { SetMode(m mode.ComponentMode) Close() - AddMethodDuration(method string, d time.Duration, success bool) + AddMethodDuration(method string, d time.Duration, success bool, ioTag string) } type noopMetrics struct{} -func (m *noopMetrics) SetParentID(string) {} -func (m *noopMetrics) SetMode(mode.ComponentMode) {} -func (m *noopMetrics) Close() {} -func (m *noopMetrics) AddMethodDuration(string, time.Duration, bool) {} +func (m *noopMetrics) SetParentID(string) {} +func (m *noopMetrics) SetMode(mode.ComponentMode) {} +func (m *noopMetrics) Close() {} +func (m *noopMetrics) AddMethodDuration(string, time.Duration, bool, string) {} diff --git a/pkg/local_object_storage/metabase/put.go b/pkg/local_object_storage/metabase/put.go index 5e1bbfe9e..160d71aef 100644 --- a/pkg/local_object_storage/metabase/put.go +++ b/pkg/local_object_storage/metabase/put.go @@ -9,6 +9,7 @@ import ( "strconv" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" objectCore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" 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" @@ -73,7 +74,7 @@ func (db *DB) Put(ctx context.Context, prm PutPrm) (res PutRes, err error) { success = false ) defer func() { - db.metrics.AddMethodDuration("Put", time.Since(startedAt), success) + db.metrics.AddMethodDuration("Put", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.Put", diff --git a/pkg/local_object_storage/metabase/select.go b/pkg/local_object_storage/metabase/select.go index 9f1b8b060..12da35808 100644 --- a/pkg/local_object_storage/metabase/select.go +++ b/pkg/local_object_storage/metabase/select.go @@ -8,6 +8,7 @@ import ( "strings" "time" + "git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" v2object "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object" @@ -71,7 +72,7 @@ func (db *DB) Select(ctx context.Context, prm SelectPrm) (res SelectRes, err err success = false ) defer func() { - db.metrics.AddMethodDuration("Select", time.Since(startedAt), success) + db.metrics.AddMethodDuration("Select", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.Select", diff --git a/pkg/local_object_storage/metabase/storage_id.go b/pkg/local_object_storage/metabase/storage_id.go index 8f2376503..db17f0fb8 100644 --- a/pkg/local_object_storage/metabase/storage_id.go +++ b/pkg/local_object_storage/metabase/storage_id.go @@ -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/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -41,7 +42,7 @@ func (db *DB) StorageID(ctx context.Context, prm StorageIDPrm) (StorageIDRes, er success = false ) defer func() { - db.metrics.AddMethodDuration("StorageID", time.Since(startedAt), success) + db.metrics.AddMethodDuration("StorageID", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.StorageID", @@ -107,7 +108,7 @@ func (db *DB) UpdateStorageID(ctx context.Context, prm UpdateStorageIDPrm) (res success = false ) defer func() { - db.metrics.AddMethodDuration("UpdateStorageID", time.Since(startedAt), success) + db.metrics.AddMethodDuration("UpdateStorageID", time.Since(startedAt), success, qos.IOTagStringFromContext(ctx)) }() _, span := tracing.StartSpanFromContext(ctx, "metabase.UpdateStorageID", diff --git a/pkg/local_object_storage/metrics/metabase.go b/pkg/local_object_storage/metrics/metabase.go index e962e37cb..b5f8b649d 100644 --- a/pkg/local_object_storage/metrics/metabase.go +++ b/pkg/local_object_storage/metrics/metabase.go @@ -34,6 +34,6 @@ func (m *metabaseMetrics) Close() { m.m.Close(m.shardID, m.path) } -func (m *metabaseMetrics) AddMethodDuration(method string, d time.Duration, success bool) { - m.m.MethodDuration(m.shardID, m.path, method, d, success) +func (m *metabaseMetrics) AddMethodDuration(method string, d time.Duration, success bool, ioTag string) { + m.m.MethodDuration(m.shardID, m.path, method, d, success, ioTag) } diff --git a/pkg/local_object_storage/shard/gc.go b/pkg/local_object_storage/shard/gc.go index 4a5ec7a71..81821dfb6 100644 --- a/pkg/local_object_storage/shard/gc.go +++ b/pkg/local_object_storage/shard/gc.go @@ -664,7 +664,7 @@ func (s *Shard) HandleExpiredLocks(ctx context.Context, epoch uint64, lockers [] if s.GetMode().NoMetabase() { return } - unlocked, err := s.metaBase.FreeLockedBy(lockers) + unlocked, err := s.metaBase.FreeLockedBy(ctx, lockers) if err != nil { s.log.Warn(ctx, logs.ShardFailureToUnlockObjects, zap.Error(err), @@ -721,7 +721,7 @@ func (s *Shard) HandleDeletedLocks(ctx context.Context, lockers []oid.Address) { return } - _, err := s.metaBase.FreeLockedBy(lockers) + _, err := s.metaBase.FreeLockedBy(ctx, lockers) if err != nil { s.log.Warn(ctx, logs.ShardFailureToUnlockObjects, zap.Error(err),