mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Add statsd gauges for row count.
This commit is contained in:
parent
29df847e22
commit
a961473422
1 changed files with 14 additions and 0 deletions
14
fragment.go
14
fragment.go
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue