szaszm commented on code in PR #1540:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1540#discussion_r1150095747
##########
extensions/rocksdb-repos/RocksDbRepository.cpp:
##########
@@ -20,22 +20,22 @@ using namespace std::literals::chrono_literals;
namespace org::apache::nifi::minifi::core::repository {
-void RocksDbRepository::printStats() {
+std::optional<RepositoryMetricsSource::RocksDbStats>
RocksDbRepository::getRocksDbStats() const {
+ RocksDbStats stats;
auto opendb = db_->open();
if (!opendb) {
- return;
+ return stats;
}
- std::string key_count;
- opendb->GetProperty("rocksdb.estimate-num-keys", &key_count);
std::string table_readers;
opendb->GetProperty("rocksdb.estimate-table-readers-mem", &table_readers);
+ stats.table_readers_size = std::stoull(table_readers);
Review Comment:
Are the possible exceptions thrown by `std::stoull` properly handled?
##########
libminifi/include/core/state/nodes/RepositoryMetricsSourceStore.h:
##########
Review Comment:
What's the purpose of extracting the functionality from RepositoryMetrics to
this new class?
##########
extensions/rocksdb-repos/RocksDbRepository.cpp:
##########
@@ -20,22 +20,22 @@ using namespace std::literals::chrono_literals;
namespace org::apache::nifi::minifi::core::repository {
-void RocksDbRepository::printStats() {
+std::optional<RepositoryMetricsSource::RocksDbStats>
RocksDbRepository::getRocksDbStats() const {
+ RocksDbStats stats;
auto opendb = db_->open();
if (!opendb) {
- return;
+ return stats;
Review Comment:
The return type is optional. Didn't you mean to return an empty optional
here, instead of a default-constructed RocksDbStats object?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]