[#1984] services/object: Increase put_req_count after the request is processed

As it is specified in metrics description.

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-11-29 14:47:00 +03:00 committed by fyrchik
parent afabd6be91
commit e21c472dc7

View file

@ -71,9 +71,6 @@ func (m MetricCollector) Get(req *object.GetRequest, stream GetObjectStream) err
func (m MetricCollector) Put(ctx context.Context) (PutObjectStream, error) { func (m MetricCollector) Put(ctx context.Context) (PutObjectStream, error) {
t := time.Now() t := time.Now()
defer func() {
m.metrics.IncPutReqCounter()
}()
stream, err := m.next.Put(ctx) stream, err := m.next.Put(ctx)
if err != nil { if err != nil {
@ -157,6 +154,7 @@ func (s putStreamMetric) Send(req *object.PutRequest) error {
func (s putStreamMetric) CloseAndRecv() (*object.PutResponse, error) { func (s putStreamMetric) CloseAndRecv() (*object.PutResponse, error) {
defer func() { defer func() {
s.metrics.IncPutReqCounter()
s.metrics.AddPutReqDuration(time.Since(s.start)) s.metrics.AddPutReqDuration(time.Since(s.start))
}() }()