Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions concourse/artifact/ELOQDSS_ROCKSDB/eloqdoc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,8 @@ storage:
txlogAsyncFsync: false
metrics:
# Metrics options.
enableMetrics: true
enableMetrics: false
metricsPort: 18081
enableMemoryUsage: true
collectMemoryUsageRound: 10000
enableCacheHitRate: true
enableTxMetrics: true
collectTxDurationRound: 100
enableBusyRoundMetrics: true
busyRoundThreshold: 10
enableRemoteRequestMetrics: true
enableLogServiceMetrics: true

setParameter:
diagnosticDataCollectionEnabled: false
Expand Down
11 changes: 1 addition & 10 deletions concourse/artifact/ELOQDSS_ROCKSDB_CLOUD_S3/eloqdoc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,8 @@ storage:
rocksdbCloudSstFileCacheSize: "1000GB"
metrics:
# Metrics options.
enableMetrics: true
enableMetrics: false
metricsPort: 18081
enableMemoryUsage: true
collectMemoryUsageRound: 10000
enableCacheHitRate: true
enableTxMetrics: true
collectTxDurationRound: 100
enableBusyRoundMetrics: true
busyRoundThreshold: 10
enableRemoteRequestMetrics: true
enableLogServiceMetrics: true

setParameter:
diagnosticDataCollectionEnabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,8 @@ storage:
dssPeerNode: 127.0.0.1:9100
metrics:
# Metrics options.
enableMetrics: true
enableMetrics: false
metricsPort: 18081
enableMemoryUsage: true
collectMemoryUsageRound: 10000
enableCacheHitRate: true
enableTxMetrics: true
collectTxDurationRound: 100
enableBusyRoundMetrics: true
busyRoundThreshold: 10
enableRemoteRequestMetrics: true
enableLogServiceMetrics: true

setParameter:
diagnosticDataCollectionEnabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,8 @@ storage:
dssPeerNode: 127.0.0.1:9100
metrics:
# Metrics options.
enableMetrics: true
enableMetrics: false
metricsPort: 18081
enableMemoryUsage: true
collectMemoryUsageRound: 10000
enableCacheHitRate: true
enableTxMetrics: true
collectTxDurationRound: 100
enableBusyRoundMetrics: true
busyRoundThreshold: 10
enableRemoteRequestMetrics: true
enableLogServiceMetrics: true

setParameter:
diagnosticDataCollectionEnabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,8 @@ storage:
dssPeerNode: 127.0.0.1:9100
metrics:
# Metrics options.
enableMetrics: true
enableMetrics: false
metricsPort: 18081
enableMemoryUsage: true
collectMemoryUsageRound: 10000
enableCacheHitRate: true
enableTxMetrics: true
collectTxDurationRound: 100
enableBusyRoundMetrics: true
busyRoundThreshold: 10
enableRemoteRequestMetrics: true
enableLogServiceMetrics: true

setParameter:
diagnosticDataCollectionEnabled: false
Expand Down
4 changes: 4 additions & 0 deletions concourse/scripts/main.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ sudo chown -R $current_user $PWD
if [ ! -d "/var/crash" ]; then sudo mkdir -p /var/crash; fi
sudo chmod 777 /var/crash

if [ ! -d "/home/$current_user/workspace" ]; then
mkdir /home/$current_user/workspace
fi

sudo chown -R $current_user /home/$current_user/workspace
cd /home/$current_user/workspace
ln -s $WORKSPACE/py_tpcc_src py-tpcc
Expand Down
4 changes: 4 additions & 0 deletions concourse/scripts/main.ent.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ sudo chown -R $current_user $PWD
if [ ! -d "/var/crash" ]; then sudo mkdir -p /var/crash; fi
sudo chmod 777 /var/crash

if [ ! -d "/home/$current_user/workspace" ]; then
mkdir /home/$current_user/workspace
fi

sudo chown -R $current_user /home/$current_user/workspace
cd /home/$current_user/workspace
ln -s $WORKSPACE/py_tpcc_src py-tpcc
Expand Down
4 changes: 4 additions & 0 deletions concourse/scripts/pr.ent.bash
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ sudo chmod 777 /var/crash
cd $WORKSPACE/eloqdoc_pr
pr_branch_name=$(cat .git/resource/metadata.json | jq -r '.[] | select(.name=="head_name") | .value')

if [ ! -d "/home/$current_user/workspace" ]; then
mkdir /home/$current_user/workspace
fi

sudo chown -R $current_user /home/$current_user/workspace
cd /home/$current_user/workspace
ln -s $WORKSPACE/py_tpcc_src py-tpcc
Expand Down
12 changes: 12 additions & 0 deletions src/mongo/db/modules/eloq/src/eloq_global_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,13 @@ Status EloqGlobalOptions::add(moe::OptionSection* options) {
"Enable log service metrics.")
.setDefault(moe::Value(true));

eloqOptions
.addOptionChaining("storage.eloq.metrics.enableKVMetrics",
"eloqEnableKVMetrics",
moe::Bool,
"Enable KV metrics.")
.setDefault(moe::Value(true));


return options->addSection(eloqOptions);
}
Expand Down Expand Up @@ -1132,6 +1139,11 @@ Status EloqGlobalOptions::store(const moe::Environment& params,
enableMetrics && params["storage.eloq.metrics.enableLogServiceMetrics"].as<bool>();
}

if (params.count("storage.eloq.metrics.enableKVMetrics")) {
enableKVMetrics =
enableMetrics && params["storage.eloq.metrics.enableKVMetrics"].as<bool>();
}


return Status::OK();
}
Expand Down
1 change: 1 addition & 0 deletions src/mongo/db/modules/eloq/src/eloq_global_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class EloqGlobalOptions {
uint32_t busyRoundThreshold{10};
bool enableRemoteRequestMetrics{true};
bool enableLogServiceMetrics{true};
bool enableKVMetrics{true};
};

extern EloqGlobalOptions eloqGlobalOptions;
Expand Down
60 changes: 57 additions & 3 deletions src/mongo/db/modules/eloq/src/eloq_kv_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <cstddef>
#include <filesystem>
#include <iomanip> // std::setfill, std::setw
#include <memory>
#include <mutex>
#include <utility>
Expand Down Expand Up @@ -569,6 +570,7 @@ EloqKVEngine::EloqKVEngine(const std::string& path) : _dbPath(path) {
metrics::enable_metrics = eloqGlobalOptions.enableMetrics;
setenv("ELOQ_METRICS_PORT", eloqGlobalOptions.metricsPortString.data(), false);
metrics::enable_log_service_metrics = eloqGlobalOptions.enableLogServiceMetrics;
metrics::enable_kv_metrics = eloqGlobalOptions.enableKVMetrics;
metrics::enable_memory_usage = eloqGlobalOptions.enableMemoryUsage;
metrics::collect_memory_usage_round = eloqGlobalOptions.collectMemoryUsageRound;
metrics::enable_cache_hit_rate = eloqGlobalOptions.enableCacheHitRate;
Expand All @@ -583,6 +585,15 @@ EloqKVEngine::EloqKVEngine(const std::string& path) : _dbPath(path) {
error() << "Failed to initialize MetricsRegristry!";
uasserted(ErrorCodes::InternalError, "MetricsRegristry initialization failed");
}

if (metrics::enable_kv_metrics) {
metrics::CommonLabels kv_common_common_labels{};
kv_common_common_labels["node_ip"] = eloqGlobalOptions.localAddr.host();
kv_common_common_labels["node_port"] =
std::to_string(eloqGlobalOptions.localAddr.port());
Eloq::storeHandler->RegisterKvMetrics(_metricsRegistry.get(), kv_common_common_labels);
}

// tx_service_common_labels
tx_service_common_labels["node_ip"] = eloqGlobalOptions.localAddr.host();
tx_service_common_labels["node_port"] = std::to_string(eloqGlobalOptions.localAddr.port());
Expand Down Expand Up @@ -1283,6 +1294,7 @@ void EloqKVEngine::cleanShutdown() {
MONGO_LOG(0) << "EloqKVEngine::cleanShutdown";

shutdownTxService();
_logServer = nullptr;
Eloq::storeHandler.reset();
Eloq::dataStoreService.reset();

Expand All @@ -1292,6 +1304,8 @@ void EloqKVEngine::cleanShutdown() {
#endif

_txService.reset();

google::ShutdownGoogleLogging();
}

void EloqKVEngine::shutdownTxService() {
Expand Down Expand Up @@ -1331,13 +1345,53 @@ void EloqKVEngine::haltOplogManager(EloqRecordStore* oplogRecordStore, bool shut
//
}

inline void CustomPrefix(std::ostream& s, const google::LogMessageInfo& l, void*) {
s << "[" //
<< std::setw(4) << 1900 + l.time.year() // YY
<< '-' // -
<< std::setw(2) << 1 + l.time.month() // MM
<< '-' // -
<< std::setw(2) << l.time.day() // DD
<< 'T' // T
<< std::setw(2) << l.time.hour() // hh
<< ':' // :
<< std::setw(2) << l.time.min() // mm
<< ':' // :
<< std::setw(2) << l.time.sec() // ss
<< '.' // .
<< std::setfill('0') << std::setw(6) //
<< l.time.usec() // usec
<< " " << l.severity[0] << " "
<< "" << l.thread_id << "] "
#ifndef DISABLE_CODE_LINE_IN_LOG
<< "[" << l.filename << ':' << l.line_number << "]";
#else
;
#endif
};

Comment thread
coderabbitai[bot] marked this conversation as resolved.
void EloqKVEngine::InitGlog() {
google::InitGoogleLogging("txservice");
std::filesystem::path systemLogPath(serverGlobalParams.logpath);
std::string logFilePath;
if (systemLogPath.has_parent_path()) {
static std::filesystem::path logdir = systemLogPath.parent_path();
GFLAGS_NAMESPACE::SetCommandLineOption("log_dir", logdir.c_str());
logFilePath = systemLogPath.parent_path().string();
logFilePath.append("/txservice");
} else {
logFilePath = "txservice";
}
FLAGS_logtostdout = false;
FLAGS_logtostderr = false;
FLAGS_minloglevel = 0;
FLAGS_stderrthreshold = google::GLOG_FATAL;
FLAGS_logbuflevel = -1;
FLAGS_log_file_header = false;
google::SetLogDestination(google::INFO, (logFilePath + ".INFO.").c_str());
google::SetLogDestination(google::WARNING, (logFilePath + ".WARNING.").c_str());
google::SetLogDestination(google::ERROR, (logFilePath + ".ERROR.").c_str());
google::SetLogSymlink(google::INFO, "txservice");
google::SetLogSymlink(google::WARNING, "txservice");
google::SetLogSymlink(google::ERROR, "txservice");
google::InitGoogleLogging("txservice", &CustomPrefix);
}
Comment thread
lzxddz marked this conversation as resolved.

MongoSystemHandler::MongoSystemHandler() {
Expand Down