Add statsd gauges for row count.

This commit is contained in:
Ben Johnson 2017-05-24 20:10:52 -06:00
parent 29df847e22
commit a961473422
No known key found for this signature in database
GPG key ID: 81741CD251883081

View file

@ -86,6 +86,9 @@ type Fragment struct {
cache Cache
CacheSize uint32
// Stats reporting.
maxRowID uint64
// Cache containing full rows (not just counts).
rowCache BitmapCache
@ -166,6 +169,11 @@ func (f *Fragment) Open() error {
// Clear checksums.
f.checksums = make(map[int][]byte)
// Read last bit to determine max row.
pos := f.storage.Max()
f.maxRowID = pos / SliceWidth
f.stats.Gauge("rows", float64(f.maxRowID))
return nil
}(); err != nil {
f.close()
@ -409,6 +417,12 @@ func (f *Fragment) setBit(rowID, columnID uint64) (changed bool, err error) {
f.stats.Count("setN", 1)
// Update row count if they have increased.
if rowID > f.maxRowID {
f.maxRowID = rowID
f.stats.Gauge("rows", float64(f.maxRowID))
}
return changed, nil
}