0
0
Fork 0

Merge pull request #792 from steveyen/more-stats

adding more scorch related stats
This commit is contained in:
Steve Yen 2018-03-02 13:41:06 -08:00 committed by GitHub
commit fd6bfb0113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 5 deletions

View File

@ -278,6 +278,8 @@ func (s *Scorch) Batch(batch *index.Batch) (err error) {
atomic.AddUint64(&s.stats.TotAnalysisTime, uint64(time.Since(start)))
indexStart := time.Now()
// notify handlers that we're about to introduce a segment
s.fireEvent(EventKindBatchIntroductionStart, 0)
@ -303,6 +305,9 @@ func (s *Scorch) Batch(batch *index.Batch) (err error) {
atomic.AddUint64(&s.stats.TotBatches, 1)
atomic.AddUint64(&s.stats.TotIndexedPlainTextBytes, numPlainTextBytes)
}
atomic.AddUint64(&s.stats.TotIndexTime, uint64(time.Since(indexStart)))
return err
}
@ -339,6 +344,8 @@ func (s *Scorch) prepareSegment(newSegment segment.Segment, ids []string,
_ = root.DecRef()
introStartTime := time.Now()
s.introductions <- introduction
// block until this segment is applied
@ -351,6 +358,12 @@ func (s *Scorch) prepareSegment(newSegment segment.Segment, ids []string,
err = <-introduction.persisted
}
introTime := uint64(time.Since(introStartTime))
atomic.AddUint64(&s.stats.TotBatchIntroTime, introTime)
if atomic.LoadUint64(&s.stats.MaxBatchIntroTime) < introTime {
atomic.AddUint64(&s.stats.MaxBatchIntroTime, introTime)
}
return err
}

View File

@ -25,11 +25,15 @@ import (
// and fields that are prefixed like TotXxxx are monotonically
// increasing counters.
type Stats struct {
TotUpdates uint64
TotDeletes uint64
TotBatches uint64
TotBatchesEmpty uint64
TotOnErrors uint64
TotUpdates uint64
TotDeletes uint64
TotBatches uint64
TotBatchesEmpty uint64
TotBatchIntroTime uint64
MaxBatchIntroTime uint64
TotOnErrors uint64
TotAnalysisTime uint64
TotIndexTime uint64