forked from TrueCloudLab/frostfs-node
[#370] Add tree service metrics
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
f2e5dead7e
commit
bc34fee6a7
9 changed files with 117 additions and 3 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"math"
|
||||
"math/rand"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
|
@ -376,9 +377,12 @@ func (s *Service) syncLoop(ctx context.Context) {
|
|||
ctx, span := tracing.StartSpanFromContext(ctx, "TreeService.sync")
|
||||
s.log.Debug(logs.TreeSyncingTrees)
|
||||
|
||||
start := time.Now()
|
||||
|
||||
cnrs, err := s.cfg.cnrSource.List()
|
||||
if err != nil {
|
||||
s.log.Error(logs.TreeCouldNotFetchContainers, zap.Error(err))
|
||||
s.metrics.AddSyncDuration(time.Since(start), false)
|
||||
span.End()
|
||||
continue
|
||||
}
|
||||
|
@ -390,6 +394,8 @@ func (s *Service) syncLoop(ctx context.Context) {
|
|||
s.removeContainers(ctx, newMap)
|
||||
|
||||
s.log.Debug(logs.TreeTreesHaveBeenSynchronized)
|
||||
|
||||
s.metrics.AddSyncDuration(time.Since(start), true)
|
||||
span.End()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue