facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
28.66k stars 6.33k forks source link

Getting compaction stats in a structured form #12986

Open jecaro opened 2 months ago

jecaro commented 2 months ago

I posted this issue to the dev group but didn't get any feedback. It is important so I'm posting a well here for greater visibility. I'd be happy to get feedback on how people address this issue.

The compaction stats are described in the wiki. They contain useful information to understand the compaction process.

Expected behavior

That data is not very usable in this form. It should be possible to have access to the compaction stats in a data structure. That data structure could then be pretty-printed as a table as described in the wiki. But having the stats in a structured form in the first place would be very useful for example to expose them as Prometheus metrics.

Actual behavior

The only way to get these compactions stats is by calling db->GetProperty("rocksdb.stats"); which returns a string. Then parse the string which is really inefficient given that data existed in private data structures at some point.

jecaro commented 2 months ago

Some useful information about this topic can be found in the google group discussion.