Remove stats from main binaries

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1851
This commit is contained in:
Matej Ferencevic 2019-02-11 13:32:09 +01:00
parent 59e11dbf9f
commit 773acc11d6
11 changed files with 10 additions and 30 deletions

View File

@ -66,7 +66,7 @@ set(MG_SINGLE_NODE_LIBS stdc++fs Threads::Threads fmt cppitertools
antlr_opencypher_parser_lib dl glog gflags
mg-utils mg-io mg-requests mg-communication)
# These are enterprise subsystems
set(MG_SINGLE_NODE_LIBS ${MG_SINGLE_NODE_LIBS} mg-integrations-kafka mg-auth mg-stats)
set(MG_SINGLE_NODE_LIBS ${MG_SINGLE_NODE_LIBS} mg-integrations-kafka mg-auth)
if (USE_LTALLOC)
list(APPEND MG_SINGLE_NODE_LIBS ltalloc)
@ -236,7 +236,7 @@ add_custom_target(generate_capnp DEPENDS generate_lcp_distributed ${generated_ca
set(MG_DISTRIBUTED_LIBS stdc++fs Threads::Threads fmt cppitertools
antlr_opencypher_parser_lib dl glog gflags capnp kj
mg-utils mg-io mg-io-serialization mg-integrations-kafka mg-requests
mg-communication mg-comm-rpc mg-auth mg-stats)
mg-communication mg-comm-rpc mg-auth)
# STATIC library used by memgraph executables
add_library(mg-distributed STATIC ${mg_distributed_sources})
@ -325,7 +325,7 @@ add_custom_target(generate_capnp_single_node_ha DEPENDS generate_lcp_single_node
set(MG_SINGLE_NODE_HA_LIBS stdc++fs Threads::Threads fmt cppitertools
antlr_opencypher_parser_lib dl glog gflags capnp kj
mg-utils mg-io mg-integrations-kafka mg-requests mg-communication mg-comm-rpc
mg-auth mg-stats)
mg-auth)
if (USE_LTALLOC)
list(APPEND MG_SINGLE_NODE_HA_LIBS ltalloc)

View File

@ -105,5 +105,5 @@ void SingleNodeMain() {
}
int main(int argc, char **argv) {
return WithInit(argc, argv, []() { return "memgraph"; }, SingleNodeMain);
return WithInit(argc, argv, SingleNodeMain);
}

View File

@ -136,15 +136,6 @@ void WorkerMain() {
}
int main(int argc, char **argv) {
auto get_stats_prefix = [&]() -> std::string {
if (FLAGS_master) {
return "master";
} else if (FLAGS_worker) {
return fmt::format("worker-{}", FLAGS_worker_id);
}
return "memgraph";
};
auto memgraph_main = [&]() {
CHECK(!(FLAGS_master && FLAGS_worker))
<< "Can't run Memgraph as worker and master at the same time!";
@ -156,5 +147,5 @@ int main(int argc, char **argv) {
WorkerMain();
};
return WithInit(argc, argv, get_stats_prefix, memgraph_main);
return WithInit(argc, argv, memgraph_main);
}

View File

@ -90,5 +90,5 @@ void SingleNodeHAMain() {
}
int main(int argc, char **argv) {
return WithInit(argc, argv, []() { return "memgraph"; }, SingleNodeHAMain);
return WithInit(argc, argv, SingleNodeHAMain);
}

View File

@ -7,7 +7,6 @@
#include "glue/communication.hpp"
#include "query/exceptions.hpp"
#include "requests/requests.hpp"
#include "stats/stats.hpp"
#include "utils/signals.hpp"
#include "utils/sysinfo/memory.hpp"
#include "utils/terminate_handler.hpp"
@ -159,7 +158,6 @@ void InitSignalHandlers(const std::function<void()> &shutdown_fun) {
}
int WithInit(int argc, char **argv,
const std::function<std::string()> &get_stats_prefix,
const std::function<void()> &memgraph_main) {
gflags::SetVersionString(version_string);
@ -175,9 +173,6 @@ int WithInit(int argc, char **argv,
// Unhandled exception handler init.
std::set_terminate(&utils::TerminateHandler);
stats::InitStatsLogging(get_stats_prefix());
utils::OnScopeExit stop_stats([] { stats::StopStatsLogging(); });
// Initialize the communication library.
communication::Init();

View File

@ -91,8 +91,7 @@ void InitSignalHandlers(const std::function<void()> &shutdown_fun);
/// Run the Memgraph server.
///
/// Sets up all the required state before running `memgraph_main` and does any
/// required cleanup afterwards. `get_stats_prefix` is used to obtain the
/// prefix when logging Memgraph's statistics.
/// required cleanup afterwards.
///
/// Command line arguments and configuration files are read before calling any
/// of the supplied functions. Therefore, you should use flags only from those
@ -104,8 +103,7 @@ void InitSignalHandlers(const std::function<void()> &shutdown_fun);
///
/// @code
/// int main(int argc, char *argv[]) {
/// auto get_stats_prefix = []() -> std::string { return "memgraph"; };
/// return WithInit(argc, argv, get_stats_prefix, SingleNodeMain);
/// return WithInit(argc, argv, SingleNodeMain);
/// }
/// @endcode
///
@ -114,5 +112,4 @@ void InitSignalHandlers(const std::function<void()> &shutdown_fun);
/// `InitSignalHandlers` with appropriate function to shutdown the server you
/// started.
int WithInit(int argc, char **argv,
const std::function<std::string()> &get_stats_prefix,
const std::function<void()> &memgraph_main);

View File

@ -5,7 +5,6 @@
#include "data_structures/concurrent/concurrent_map.hpp"
#include "storage/distributed/mvcc/version_list.hpp"
#include "stats/metrics.hpp"
#include "storage/distributed/deferred_deleter.hpp"
#include "storage/distributed/edge.hpp"
#include "storage/distributed/garbage_collector.hpp"

View File

@ -5,7 +5,6 @@
#include "data_structures/concurrent/concurrent_map.hpp"
#include "storage/single_node/mvcc/version_list.hpp"
#include "stats/metrics.hpp"
#include "storage/single_node/deferred_deleter.hpp"
#include "storage/single_node/edge.hpp"
#include "storage/single_node/garbage_collector.hpp"

View File

@ -5,7 +5,6 @@
#include "data_structures/concurrent/concurrent_map.hpp"
#include "raft/raft_server.hpp"
#include "stats/metrics.hpp"
#include "storage/single_node_ha/deferred_deleter.hpp"
#include "storage/single_node_ha/edge.hpp"
#include "storage/single_node_ha/garbage_collector.hpp"

View File

@ -104,5 +104,5 @@ void KafkaBenchmarkMain() {
}
int main(int argc, char **argv) {
return WithInit(argc, argv, []() { return "memgraph"; }, KafkaBenchmarkMain);
return WithInit(argc, argv, KafkaBenchmarkMain);
}

View File

@ -144,7 +144,7 @@ add_unit_test(kvstore.cpp)
target_link_libraries(${test_prefix}kvstore kvstore_lib glog)
add_unit_test(metrics.cpp)
target_link_libraries(${test_prefix}metrics mg-single-node kvstore_dummy_lib)
target_link_libraries(${test_prefix}metrics mg-stats)
add_unit_test(mvcc.cpp)
target_link_libraries(${test_prefix}mvcc mg-single-node kvstore_dummy_lib)