Skip to content

Commit

Permalink
[chore] - log enumeration duration (#1187)
Browse files Browse the repository at this point in the history
* log enumeration duration.

* use defer to print enumeration duration stat.

* remove temp var.
  • Loading branch information
ahrav authored Mar 21, 2023
1 parent 62d44f5 commit ffbd9c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/sources/gcs/gcs_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ func (g *gcsManager) enumerate(ctx context.Context, bkts []bucket) (*attributes,
logger.V(5).Info("enumerating buckets", "numBuckets", len(bkts))
stats := newStats(len(bkts))

defer func(start time.Time) {
logger.V(5).Info("finished enumerating buckets", "duration-seconds", fmt.Sprintf("%.1f", time.Since(start).Seconds()), "num-buckets", len(bkts), "num-objects", stats.numObjects)
}(time.Now())

for _, bkt := range bkts {
bkt := bkt
g.workerPool.Go(func() error {
Expand Down Expand Up @@ -426,7 +430,6 @@ func (g *gcsManager) enumerate(ctx context.Context, bkts []bucket) (*attributes,

_ = g.workerPool.Wait()
g.attr = stats
logger.V(5).Info("finished enumerating buckets", "num-objects", stats.numObjects, "num-buckets", stats.numBuckets)

return stats, nil
}
Expand Down

0 comments on commit ffbd9c1

Please sign in to comment.