| 1571 | } |
| 1572 | |
| 1573 | std::string Server::GetRocksDBStatsJson() const { |
| 1574 | jsoncons::json stats_json; |
| 1575 | |
| 1576 | auto stats = storage->GetDB()->GetDBOptions().statistics; |
| 1577 | for (const auto &iter : rocksdb::TickersNameMap) { |
| 1578 | stats_json[iter.second] = stats->getTickerCount(iter.first); |
| 1579 | } |
| 1580 | |
| 1581 | for (const auto &iter : rocksdb::HistogramsNameMap) { |
| 1582 | rocksdb::HistogramData hist_data; |
| 1583 | stats->histogramData(iter.first, &hist_data); |
| 1584 | /* P50 P95 P99 P100 COUNT SUM */ |
| 1585 | stats_json[iter.second] = |
| 1586 | jsoncons::json(jsoncons::json_array_arg, {hist_data.median, hist_data.percentile95, hist_data.percentile99, |
| 1587 | hist_data.max, hist_data.count, hist_data.sum}); |
| 1588 | } |
| 1589 | |
| 1590 | return stats_json.to_string(); |
| 1591 | } |
| 1592 | |
| 1593 | // This function is called by replication thread when finished fetching all files from its master. |
| 1594 | // Before restoring the db from backup or checkpoint, we should |