RocksDB Metrics

829 Views Asked by At

I'm using RocksDB in my project with the SpringBoot Microservices. For monitoring & troubleshooting purposes, I want to export RocksDB metrics daily. I have exposed some metrics like Column Family, Estimated Counts, RocksDB Properties, etc. Now I want to expose a few more metrics like memory usage, cache details, RocksDB hit count, etc.

In the RocksDB wiki, I found - Memory Usage in RocksDB

Is there any way to expose these metrics?

Thanks

1

There are 1 best solutions below

3
hx235 On BEST ANSWER

memory usage

The WIKI you pointed has good metrics you can start with. If you already exposed "RocksDB Properties" as you mentioned, then you can do the same with those by calling db->getProperty()

cache details, RocksDB hit count

Depending on what details you want, you can look into at least two places: kBlockCacheEntryStats in db properties https://github.com/facebook/rocksdb/blob/main/include/rocksdb/db.h#L979-L987 or cache related statistics in https://github.com/facebook/rocksdb/blob/main/include/rocksdb/statistics.h (search "cache"). Statistics are exposed by Statistics::getTickerCount or Statistics::histogramData()

etc.

For others, please refer to db.h (properties section https://github.com/facebook/rocksdb/blob/main/include/rocksdb/db.h#L921), statistics.h (https://github.com/facebook/rocksdb/blob/main/monitoring/statistics.h), perf_context.h (https://github.com/facebook/rocksdb/blob/main/include/rocksdb/perf_context.h) files for more