From ab21d90cfb3b8a91d88268723abbba3c7a1d21f1 Mon Sep 17 00:00:00 2001 From: Artem Tataurov Date: Tue, 7 Feb 2023 14:28:28 +0300 Subject: [PATCH] [#1794] shard: Add increasing case for the payload size metric Signed-off-by: Artem Tataurov --- CHANGELOG.md | 1 + pkg/local_object_storage/shard/delete.go | 2 +- pkg/local_object_storage/shard/put.go | 1 + pkg/local_object_storage/shard/shard.go | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eb2869b6..f72a67765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Changelog for FrostFS Node - Env prefix in configuration changed to `FROSTFS_*` (#43) ### Fixed +- Increase payload size metric on shards' `put` operation (#1794) - Big object removal with non-local parts (#1978) - Disable pilorama when moving to degraded mode (#2197) - Fetching blobovnicza objects that not found in write-cache (#2206) diff --git a/pkg/local_object_storage/shard/delete.go b/pkg/local_object_storage/shard/delete.go index 71797d405..9cb9cfe8b 100644 --- a/pkg/local_object_storage/shard/delete.go +++ b/pkg/local_object_storage/shard/delete.go @@ -87,7 +87,7 @@ func (s *Shard) delete(prm DeletePrm) (DeleteRes, error) { totalRemovedPayload += removedPayload s.addToContainerSize(prm.addr[i].Container().EncodeToString(), -int64(removedPayload)) } - s.addToPayloadCounter(-int64(totalRemovedPayload)) + s.addToPayloadSize(-int64(totalRemovedPayload)) for i := range prm.addr { var delPrm common.DeletePrm diff --git a/pkg/local_object_storage/shard/put.go b/pkg/local_object_storage/shard/put.go index 84ae3b006..311759dab 100644 --- a/pkg/local_object_storage/shard/put.go +++ b/pkg/local_object_storage/shard/put.go @@ -79,6 +79,7 @@ func (s *Shard) Put(prm PutPrm) (PutRes, error) { } s.incObjectCounter() + s.addToPayloadSize(int64(prm.obj.PayloadSize())) s.addToContainerSize(putPrm.Address.Container().EncodeToString(), int64(prm.obj.PayloadSize())) } diff --git a/pkg/local_object_storage/shard/shard.go b/pkg/local_object_storage/shard/shard.go index ad87d28d8..b1116d8f3 100644 --- a/pkg/local_object_storage/shard/shard.go +++ b/pkg/local_object_storage/shard/shard.go @@ -388,7 +388,7 @@ func (s *Shard) addToContainerSize(cnr string, size int64) { } } -func (s *Shard) addToPayloadCounter(size int64) { +func (s *Shard) addToPayloadSize(size int64) { if s.cfg.metricsWriter != nil { s.cfg.metricsWriter.AddToPayloadSize(size) }