Skip to content

Commit

Permalink
storage/engine: implement Pebble.GetStats
Browse files Browse the repository at this point in the history
Fixes #41600

Release note: None
  • Loading branch information
petermattis committed Oct 24, 2019
1 parent 7ac14eb commit f581b8d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/storage/engine/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,21 @@ func (p *Pebble) Flush() error {

// GetStats implements the Engine interface.
func (p *Pebble) GetStats() (*Stats, error) {
// TODO(itsbilal): Implement this.
return &Stats{}, nil
m := p.db.Metrics()
return &Stats{
BlockCacheHits: m.BlockCache.Hits,
BlockCacheMisses: m.BlockCache.Misses,
BlockCacheUsage: m.BlockCache.Size,
BlockCachePinnedUsage: 0,
BloomFilterPrefixChecked: m.Filter.Hits + m.Filter.Misses,
BloomFilterPrefixUseful: m.Filter.Hits,
MemtableTotalSize: int64(m.MemTable.Size),
Flushes: m.Flush.Count,
Compactions: m.Compact.Count,
TableReadersMemEstimate: m.TableCache.Size,
PendingCompactionBytesEstimate: int64(m.Compact.EstimatedDebt),
L0FileCount: m.Levels[0].NumFiles,
}, nil
}

// GetEnvStats implements the Engine interface.
Expand Down

0 comments on commit f581b8d

Please sign in to comment.