From df1b2a24226f7cbec6eaee8ce3c17b67c994f2b9 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 24 Sep 2014 17:18:48 +0200 Subject: [PATCH] Fix indexing latency instrumentation. Change-Id: I532c170121cd2996d1a378adbb1fd551cd5a4e38 --- storage/local/persistence.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/local/persistence.go b/storage/local/persistence.go index 0c6bb19e3..128544e6a 100644 --- a/storage/local/persistence.go +++ b/storage/local/persistence.go @@ -710,9 +710,10 @@ func (p *diskPersistence) processIndexingQueue() { defer batchTimeout.Stop() commitBatch := func() { - begin := time.Now() - defer p.indexingBatchLatency.Observe(float64(time.Since(begin) / time.Millisecond)) p.indexingBatchSizes.Observe(float64(batchSize)) + defer func(begin time.Time) { + p.indexingBatchLatency.Observe(float64(time.Since(begin) / time.Millisecond)) + }(time.Now()) if err := p.labelPairToFingerprints.IndexBatch(pairToFPs); err != nil { glog.Error("Error indexing label pair to fingerprints batch: ", err)