Prometheus Exporter for RocksJava. Monitor Java RocksDB by using Prometheus and Grafana.
Prometheus Exporter for RocksJava. Monitor Java RocksDB by using Prometheus and Grafana.
In development
In development
In development
This is a simple example how we can expose RocksDB metrics. Your RocksDB metrics will be exposed at http://localhost:9098/rocksdb_stats.
public class Example {
public static void main(String[] args) {
// HTTP server port
int port = 9098;
// RocksDB instance from your application
RocksDB db = null; // db instance
Statistics stats = null; // stats your RocksDB instance
List<ColumnFamilyHandle> cfHandles = null; // stats your Column Families
try {
// wrap RocksDB instance to jRocksDB
JRocksDB jRocksDB = new JRocksDB(db, stats, cfHandles);
// init an exporter instance for your RocksDB
JRocksDBExporter exporter = new JRocksDBExporter(port, jRocksDB);
// start HTTP server on port for exposing RocksDB metrics
exporter.start();
System.out.println("Server is running on port " + port);
System.out.println(">>> RocksDB metrics is exposed at http://localhost:" + port + "/rocksdb_stats");
} catch (Exception ex) {
System.err.println(ex);
}
}
}
There are 2 metric types exported from http://localhost:9098/rocksdb_stats
rocksdb_props
: stats for Column Families (CF), including default
, All_CFs
and your custom CFs.rocksdb_stats
: stats for RocksDB from TickerType
of RocksDB Statistics.rocksdb_props{cf = "[CF_NAME]", prop = "[CF_PROPERTIY]"}
cf
: Column Family name, including default
, All_CFs
and your custom CFs.prop
: Column Family property, from rocksdb/include/rocksdb/db.hrocksdb_stats{ticker = "[TICKER_TYPE_NAME]"}
ticker
: TickerType
of RocksDB Statistics, Java DocAdd a job rocksdb_stats to your prometheus.yml
scrape_configs:
- job_name: rocksdb_stats
scrape_interval: 5s
scrape_timeout: 5s
metrics_path: "/rocksdb_stats"
static_configs:
- targets: # list your RocksDB instances
- localhost:9098
In development
In development