[#426] engine: Support duration metrics
With `enable metrics` option, engine will collect durations for all public methods. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
bc6e7a823b
commit
980b774af2
12 changed files with 169 additions and 0 deletions
|
@ -34,6 +34,10 @@ func (p *PutPrm) WithObject(obj *object.Object) *PutPrm {
|
|||
// Returns any error encountered that
|
||||
// did not allow to completely save the object.
|
||||
func (e *StorageEngine) Put(prm *PutPrm) (*PutRes, error) {
|
||||
if e.enableMetrics {
|
||||
defer elapsed(putDuration)()
|
||||
}
|
||||
|
||||
_, err := e.exists(prm.obj.Address()) // todo: make this check parallel
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue