From aa3f92793b03acc7cd0a4dc9e175325342018cdc Mon Sep 17 00:00:00 2001 From: jievince <38901892+jievince@users.noreply.github.com> Date: Thu, 16 Dec 2021 15:44:48 +0800 Subject: [PATCH] add some kv, raft related counters --- src/clients/meta/CMakeLists.txt | 1 + src/clients/meta/MetaClient.cpp | 3 ++ src/clients/meta/stats/CMakeLists.txt | 9 ++++++ src/clients/meta/stats/MetaClientStats.cpp | 19 +++++++++++++ src/clients/meta/stats/MetaClientStats.h | 17 +++++++++++ src/clients/storage/CMakeLists.txt | 2 ++ src/clients/storage/StorageClientBase-inl.h | 5 ++++ src/clients/storage/stats/CMakeLists.txt | 9 ++++++ .../storage/stats/StorageClientStats.cpp | 20 +++++++++++++ .../storage/stats/StorageClientStats.h | 17 +++++++++++ src/codec/test/CMakeLists.txt | 3 ++ src/common/expression/test/CMakeLists.txt | 4 ++- src/daemons/CMakeLists.txt | 9 +++++- src/daemons/GraphDaemon.cpp | 4 +-- src/daemons/MetaDaemon.cpp | 4 +++ src/daemons/StorageDaemon.cpp | 4 +++ src/graph/context/test/CMakeLists.txt | 4 ++- src/graph/executor/Executor.cpp | 2 +- src/graph/executor/test/CMakeLists.txt | 4 ++- src/graph/optimizer/test/CMakeLists.txt | 4 ++- src/graph/planner/test/CMakeLists.txt | 2 +- src/graph/service/GraphService.cpp | 2 +- src/graph/service/QueryInstance.cpp | 2 +- src/graph/session/ClientSession.cpp | 2 +- src/graph/session/GraphSessionManager.cpp | 2 +- src/graph/stats/CMakeLists.txt | 4 +-- .../stats/{StatsDef.cpp => GraphStats.cpp} | 10 +++++-- src/graph/stats/{StatsDef.h => GraphStats.h} | 6 ++-- src/graph/util/test/CMakeLists.txt | 4 ++- src/graph/validator/test/CMakeLists.txt | 4 ++- src/graph/visitor/test/CMakeLists.txt | 4 ++- src/kvstore/CMakeLists.txt | 1 + src/kvstore/Part.cpp | 3 ++ src/kvstore/raftex/RaftPart.cpp | 6 ++++ src/kvstore/raftex/RaftPart.h | 5 ++++ src/kvstore/raftex/RaftexService.cpp | 1 + src/kvstore/raftex/test/CMakeLists.txt | 4 +++ src/kvstore/stats/CMakeLists.txt | 9 ++++++ src/kvstore/stats/KVStats.cpp | 28 +++++++++++++++++++ src/kvstore/stats/KVStats.h | 20 +++++++++++++ src/kvstore/test/CMakeLists.txt | 4 +++ src/meta/CMakeLists.txt | 6 ++++ src/meta/stats/CMakeLists.txt | 9 ++++++ src/meta/stats/MetaStats.cpp | 12 ++++++++ src/meta/stats/MetaStats.h | 14 ++++++++++ src/parser/test/CMakeLists.txt | 4 ++- src/storage/CMakeLists.txt | 1 + src/storage/GraphStorageServiceHandler.cpp | 6 ---- src/storage/admin/AdminProcessor.h | 2 ++ src/storage/mutate/AddEdgesProcessor.cpp | 2 +- src/storage/mutate/AddEdgesProcessor.h | 1 - src/storage/mutate/AddVerticesProcessor.cpp | 2 +- src/storage/mutate/AddVerticesProcessor.h | 1 - src/storage/mutate/DeleteEdgesProcessor.cpp | 2 +- src/storage/mutate/DeleteEdgesProcessor.h | 1 - src/storage/mutate/DeleteTagsProcessor.cpp | 2 +- src/storage/mutate/DeleteTagsProcessor.h | 1 - .../mutate/DeleteVerticesProcessor.cpp | 2 +- src/storage/mutate/DeleteVerticesProcessor.h | 1 - src/storage/stats/CMakeLists.txt | 9 ++++++ src/storage/stats/StorageStats.cpp | 28 +++++++++++++++++++ src/storage/stats/StorageStats.h | 20 +++++++++++++ src/storage/test/CMakeLists.txt | 4 +++ src/tools/db-dump/CMakeLists.txt | 4 +++ src/tools/db-upgrade/CMakeLists.txt | 4 +++ src/tools/meta-dump/CMakeLists.txt | 4 +++ src/tools/simple-kv-verify/CMakeLists.txt | 4 +++ src/tools/storage-perf/CMakeLists.txt | 4 +++ 68 files changed, 375 insertions(+), 42 deletions(-) create mode 100644 src/clients/meta/stats/CMakeLists.txt create mode 100644 src/clients/meta/stats/MetaClientStats.cpp create mode 100644 src/clients/meta/stats/MetaClientStats.h create mode 100644 src/clients/storage/stats/CMakeLists.txt create mode 100644 src/clients/storage/stats/StorageClientStats.cpp create mode 100644 src/clients/storage/stats/StorageClientStats.h rename src/graph/stats/{StatsDef.cpp => GraphStats.cpp} (94%) rename src/graph/stats/{StatsDef.h => GraphStats.h} (92%) create mode 100644 src/kvstore/stats/CMakeLists.txt create mode 100644 src/kvstore/stats/KVStats.cpp create mode 100644 src/kvstore/stats/KVStats.h create mode 100644 src/meta/stats/CMakeLists.txt create mode 100644 src/meta/stats/MetaStats.cpp create mode 100644 src/meta/stats/MetaStats.h create mode 100644 src/storage/stats/CMakeLists.txt create mode 100644 src/storage/stats/StorageStats.cpp create mode 100644 src/storage/stats/StorageStats.h diff --git a/src/clients/meta/CMakeLists.txt b/src/clients/meta/CMakeLists.txt index 113b88245c6..c5175f58ff6 100644 --- a/src/clients/meta/CMakeLists.txt +++ b/src/clients/meta/CMakeLists.txt @@ -12,4 +12,5 @@ nebula_add_library( FileBasedClusterIdMan.cpp ) +nebula_add_subdirectory(stats) nebula_add_subdirectory(test) diff --git a/src/clients/meta/MetaClient.cpp b/src/clients/meta/MetaClient.cpp index f891fb94c5b..80ecc020629 100644 --- a/src/clients/meta/MetaClient.cpp +++ b/src/clients/meta/MetaClient.cpp @@ -12,6 +12,7 @@ #include #include "clients/meta/FileBasedClusterIdMan.h" +#include "clients/meta/stats/MetaClientStats.h" #include "common/base/Base.h" #include "common/base/MurmurHash2.h" #include "common/conf/Configuration.h" @@ -626,6 +627,7 @@ void MetaClient::getResponse(Request req, bool toLeader, int32_t retry, int32_t retryLimit) { + stats::StatsManager::addValue(kNumRpcSentToMetad); auto* evb = ioThreadPool_->getEventBase(); HostAddr host; { @@ -660,6 +662,7 @@ void MetaClient::getResponse(Request req, this](folly::Try&& t) mutable { // exception occurred during RPC if (t.hasException()) { + stats::StatsManager::addValue(kNumRpcSentToMetadFailed); if (toLeader) { updateLeader(); } else { diff --git a/src/clients/meta/stats/CMakeLists.txt b/src/clients/meta/stats/CMakeLists.txt new file mode 100644 index 00000000000..68a18484869 --- /dev/null +++ b/src/clients/meta/stats/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. + +nebula_add_library( + meta_client_stats_obj + OBJECT + MetaClientStats.cpp + ) diff --git a/src/clients/meta/stats/MetaClientStats.cpp b/src/clients/meta/stats/MetaClientStats.cpp new file mode 100644 index 00000000000..3f73f4f76fe --- /dev/null +++ b/src/clients/meta/stats/MetaClientStats.cpp @@ -0,0 +1,19 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#include "clients/meta/stats/MetaClientStats.h" + +namespace nebula { + +stats::CounterId kNumRpcSentToMetad; +stats::CounterId kNumRpcSentToMetadFailed; + +void initMetaClientStats() { + kNumRpcSentToMetad = stats::StatsManager::registerStats("num_rpc_sent_to_metad", "rate, sum"); + kNumRpcSentToMetadFailed = + stats::StatsManager::registerStats("num_rpc_sent_to_metad_failed", "rate, sum"); +} + +} // namespace nebula diff --git a/src/clients/meta/stats/MetaClientStats.h b/src/clients/meta/stats/MetaClientStats.h new file mode 100644 index 00000000000..46fa1497931 --- /dev/null +++ b/src/clients/meta/stats/MetaClientStats.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#pragma once + +#include "common/stats/StatsManager.h" + +namespace nebula { + +extern stats::CounterId kNumRpcSentToMetad; +extern stats::CounterId kNumRpcSentToMetadFailed; + +void initMetaClientStats(); + +} // namespace nebula diff --git a/src/clients/storage/CMakeLists.txt b/src/clients/storage/CMakeLists.txt index c6df1f8dda6..34293727a3a 100644 --- a/src/clients/storage/CMakeLists.txt +++ b/src/clients/storage/CMakeLists.txt @@ -19,3 +19,5 @@ nebula_add_library( InternalStorageClient.cpp ) +nebula_add_subdirectory(stats) + diff --git a/src/clients/storage/StorageClientBase-inl.h b/src/clients/storage/StorageClientBase-inl.h index a402bc71a88..abeb3ed130c 100644 --- a/src/clients/storage/StorageClientBase-inl.h +++ b/src/clients/storage/StorageClientBase-inl.h @@ -7,7 +7,9 @@ #include +#include "clients/storage/stats/StorageClientStats.h" #include "common/ssl/SSLConfig.h" +#include "common/stats/StatsManager.h" #include "common/time/WallClock.h" namespace nebula { @@ -230,6 +232,7 @@ void StorageClientBase::getResponseImpl( std::pair request, RemoteFunc remoteFunc, std::shared_ptr>> pro) { + stats::StatsManager::addValue(kNumRpcSentToStoraged); using TransportException = apache::thrift::transport::TTransportException; if (evb == nullptr) { DCHECK(!!ioThreadPool_); @@ -266,6 +269,7 @@ void StorageClientBase::getResponseImpl( .thenError(folly::tag_t{}, [spaceId, partsId = std::move(partsId), host, pro, this]( TransportException&& ex) mutable { + stats::StatsManager::addValue(kNumRpcSentToStoragedFailed); if (ex.getType() == TransportException::TIMED_OUT) { LOG(ERROR) << "Request to " << host << " time out: " << ex.what(); } else { @@ -278,6 +282,7 @@ void StorageClientBase::getResponseImpl( .thenError(folly::tag_t{}, [spaceId, partsId = std::move(partsId), host, pro, this]( std::exception&& ex) mutable { + stats::StatsManager::addValue(kNumRpcSentToStoragedFailed); // exception occurred during RPC pro->setValue(Status::Error( folly::stringPrintf("RPC failure in StorageClient: %s", ex.what()))); diff --git a/src/clients/storage/stats/CMakeLists.txt b/src/clients/storage/stats/CMakeLists.txt new file mode 100644 index 00000000000..a1acb23dcea --- /dev/null +++ b/src/clients/storage/stats/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. + +nebula_add_library( + storage_client_stats_obj + OBJECT + StorageClientStats.cpp + ) diff --git a/src/clients/storage/stats/StorageClientStats.cpp b/src/clients/storage/stats/StorageClientStats.cpp new file mode 100644 index 00000000000..097f4cf3e8c --- /dev/null +++ b/src/clients/storage/stats/StorageClientStats.cpp @@ -0,0 +1,20 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#include "clients/meta/stats/MetaClientStats.h" + +namespace nebula { + +stats::CounterId kNumRpcSentToStoraged; +stats::CounterId kNumRpcSentToStoragedFailed; + +void initStorageClientStats() { + kNumRpcSentToStoraged = + stats::StatsManager::registerStats("num_rpc_sent_to_storaged", "rate, sum"); + kNumRpcSentToStoragedFailed = + stats::StatsManager::registerStats("num_rpc_sent_to_storaged_failed", "rate, sum"); +} + +} // namespace nebula diff --git a/src/clients/storage/stats/StorageClientStats.h b/src/clients/storage/stats/StorageClientStats.h new file mode 100644 index 00000000000..9c2e3567e4d --- /dev/null +++ b/src/clients/storage/stats/StorageClientStats.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#pragma once + +#include "common/stats/StatsManager.h" + +namespace nebula { + +extern stats::CounterId kNumRpcSentToStoraged; +extern stats::CounterId kNumRpcSentToStoragedFailed; + +void initStorageClientStats(); + +} // namespace nebula diff --git a/src/codec/test/CMakeLists.txt b/src/codec/test/CMakeLists.txt index f529f16431e..1bf4e06fe07 100644 --- a/src/codec/test/CMakeLists.txt +++ b/src/codec/test/CMakeLists.txt @@ -22,6 +22,9 @@ set(CODEC_TEST_LIBS $ $ $ + $ + $ + $ $ $ $ diff --git a/src/common/expression/test/CMakeLists.txt b/src/common/expression/test/CMakeLists.txt index 09c9e139b58..b71eb7aac88 100644 --- a/src/common/expression/test/CMakeLists.txt +++ b/src/common/expression/test/CMakeLists.txt @@ -9,7 +9,9 @@ set(expression_test_common_libs $ $ $ - $ + $ + $ + $ $ $ $ diff --git a/src/daemons/CMakeLists.txt b/src/daemons/CMakeLists.txt index 292c3936d78..cc0530863f7 100644 --- a/src/daemons/CMakeLists.txt +++ b/src/daemons/CMakeLists.txt @@ -38,6 +38,11 @@ set(common_deps set(storage_meta_deps $ + $ + $ + $ + $ + $ $ $ $ @@ -109,7 +114,9 @@ nebula_add_executable( SetupLogging.cpp SetupBreakpad.cpp OBJECTS - $ + $ + $ + $ $ $ $ diff --git a/src/daemons/GraphDaemon.cpp b/src/daemons/GraphDaemon.cpp index 78cfdd36370..7a32be6c1ac 100644 --- a/src/daemons/GraphDaemon.cpp +++ b/src/daemons/GraphDaemon.cpp @@ -18,7 +18,7 @@ #include "common/time/TimezoneInfo.h" #include "graph/service/GraphFlags.h" #include "graph/service/GraphService.h" -#include "graph/stats/StatsDef.h" +#include "graph/stats/GraphStats.h" #include "version/Version.h" #include "webservice/WebService.h" @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) { if (FLAGS_enable_ssl || FLAGS_enable_graph_ssl || FLAGS_enable_meta_ssl) { folly::ssl::init(); } - nebula::initCounters(); + nebula::initGraphStats(); if (FLAGS_flagfile.empty()) { printHelp(argv[0]); diff --git a/src/daemons/MetaDaemon.cpp b/src/daemons/MetaDaemon.cpp index a4acb2f757e..abce0c4758c 100644 --- a/src/daemons/MetaDaemon.cpp +++ b/src/daemons/MetaDaemon.cpp @@ -27,6 +27,7 @@ #include "meta/http/MetaHttpIngestHandler.h" #include "meta/http/MetaHttpReplaceHostHandler.h" #include "meta/processors/job/JobManager.h" +#include "meta/stats/MetaStats.h" #include "version/Version.h" #include "webservice/Router.h" #include "webservice/WebService.h" @@ -218,6 +219,9 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } + // Init stats + nebula::initMetaStats(); + folly::init(&argc, &argv, true); if (FLAGS_enable_ssl || FLAGS_enable_meta_ssl) { folly::ssl::init(); diff --git a/src/daemons/StorageDaemon.cpp b/src/daemons/StorageDaemon.cpp index 37e5957c4f8..124a2cc7c20 100644 --- a/src/daemons/StorageDaemon.cpp +++ b/src/daemons/StorageDaemon.cpp @@ -12,6 +12,7 @@ #include "common/process/ProcessUtils.h" #include "common/time/TimezoneInfo.h" #include "storage/StorageServer.h" +#include "storage/stats/StorageStats.h" #include "version/Version.h" DEFINE_string(local_ip, "", "IP address which is used to identify this server"); @@ -80,6 +81,9 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } + // Init stats + nebula::initStorageStats(); + folly::init(&argc, &argv, true); if (FLAGS_enable_ssl || FLAGS_enable_meta_ssl) { folly::ssl::init(); diff --git a/src/graph/context/test/CMakeLists.txt b/src/graph/context/test/CMakeLists.txt index 6b8286bfec0..779335bc5a0 100644 --- a/src/graph/context/test/CMakeLists.txt +++ b/src/graph/context/test/CMakeLists.txt @@ -43,7 +43,9 @@ SET(CONTEXT_TEST_LIBS $ $ $ - $ + $ + $ + $ ) nebula_add_test( diff --git a/src/graph/executor/Executor.cpp b/src/graph/executor/Executor.cpp index f33b14bd24c..4e753d4b013 100644 --- a/src/graph/executor/Executor.cpp +++ b/src/graph/executor/Executor.cpp @@ -99,7 +99,7 @@ #include "graph/planner/plan/PlanNode.h" #include "graph/planner/plan/Query.h" #include "graph/service/GraphFlags.h" -#include "graph/stats/StatsDef.h" +#include "graph/stats/GraphStats.h" #include "interface/gen-cpp2/graph_types.h" using folly::stringPrintf; diff --git a/src/graph/executor/test/CMakeLists.txt b/src/graph/executor/test/CMakeLists.txt index 081c935649b..50030fc2053 100644 --- a/src/graph/executor/test/CMakeLists.txt +++ b/src/graph/executor/test/CMakeLists.txt @@ -54,7 +54,9 @@ SET(EXEC_QUERY_TEST_OBJS $ $ $ - $ + $ + $ + $ ) SET(EXEC_QUERY_TEST_LIBS diff --git a/src/graph/optimizer/test/CMakeLists.txt b/src/graph/optimizer/test/CMakeLists.txt index e29af4031e2..ae0f1357bb3 100644 --- a/src/graph/optimizer/test/CMakeLists.txt +++ b/src/graph/optimizer/test/CMakeLists.txt @@ -49,7 +49,9 @@ set(OPTIMIZER_TEST_LIB $ $ $ - $ + $ + $ + $ ) nebula_add_test( diff --git a/src/graph/planner/test/CMakeLists.txt b/src/graph/planner/test/CMakeLists.txt index 02aa6b5edb0..ac07fbb708f 100644 --- a/src/graph/planner/test/CMakeLists.txt +++ b/src/graph/planner/test/CMakeLists.txt @@ -18,7 +18,7 @@ nebula_add_test( $ $ $ - $ + $ $ $ $ diff --git a/src/graph/service/GraphService.cpp b/src/graph/service/GraphService.cpp index 6a360e6704d..e63550e4b6e 100644 --- a/src/graph/service/GraphService.cpp +++ b/src/graph/service/GraphService.cpp @@ -15,7 +15,7 @@ #include "graph/service/GraphFlags.h" #include "graph/service/PasswordAuthenticator.h" #include "graph/service/RequestContext.h" -#include "graph/stats/StatsDef.h" +#include "graph/stats/GraphStats.h" #include "version/Version.h" namespace nebula { diff --git a/src/graph/service/QueryInstance.cpp b/src/graph/service/QueryInstance.cpp index aede766d5ee..4b42a5c9a7f 100644 --- a/src/graph/service/QueryInstance.cpp +++ b/src/graph/service/QueryInstance.cpp @@ -15,7 +15,7 @@ #include "graph/planner/plan/PlanNode.h" #include "graph/scheduler/AsyncMsgNotifyBasedScheduler.h" #include "graph/scheduler/Scheduler.h" -#include "graph/stats/StatsDef.h" +#include "graph/stats/GraphStats.h" #include "graph/util/AstUtils.h" #include "graph/validator/Validator.h" #include "parser/ExplainSentence.h" diff --git a/src/graph/session/ClientSession.cpp b/src/graph/session/ClientSession.cpp index 74fa1f6cfbc..7451eb5d312 100644 --- a/src/graph/session/ClientSession.cpp +++ b/src/graph/session/ClientSession.cpp @@ -8,7 +8,7 @@ #include "common/stats/StatsManager.h" #include "common/time/WallClock.h" #include "graph/context/QueryContext.h" -#include "graph/stats/StatsDef.h" +#include "graph/stats/GraphStats.h" namespace nebula { namespace graph { diff --git a/src/graph/session/GraphSessionManager.cpp b/src/graph/session/GraphSessionManager.cpp index 3d256bac75d..d4a9851a859 100644 --- a/src/graph/session/GraphSessionManager.cpp +++ b/src/graph/session/GraphSessionManager.cpp @@ -9,7 +9,7 @@ #include "common/stats/StatsManager.h" #include "common/time/WallClock.h" #include "graph/service/GraphFlags.h" -#include "graph/stats/StatsDef.h" +#include "graph/stats/GraphStats.h" namespace nebula { namespace graph { diff --git a/src/graph/stats/CMakeLists.txt b/src/graph/stats/CMakeLists.txt index a1cd2878085..e837ad66cf8 100644 --- a/src/graph/stats/CMakeLists.txt +++ b/src/graph/stats/CMakeLists.txt @@ -3,7 +3,7 @@ # This source code is licensed under Apache 2.0 License. nebula_add_library( - stats_def_obj + graph_stats_obj OBJECT - StatsDef.cpp + GraphStats.cpp ) diff --git a/src/graph/stats/StatsDef.cpp b/src/graph/stats/GraphStats.cpp similarity index 94% rename from src/graph/stats/StatsDef.cpp rename to src/graph/stats/GraphStats.cpp index 4292d7c3075..adab4a84352 100644 --- a/src/graph/stats/StatsDef.cpp +++ b/src/graph/stats/GraphStats.cpp @@ -3,10 +3,11 @@ * This source code is licensed under Apache 2.0 License. */ -#include "graph/stats/StatsDef.h" +#include "graph/stats/GraphStats.h" +#include "clients/meta/stats/MetaClientStats.h" +#include "clients/storage/stats/StorageClientStats.h" #include "common/base/Base.h" -#include "common/stats/StatsManager.h" DEFINE_int32(slow_query_threshold_us, 200000, @@ -40,7 +41,7 @@ stats::CounterId kNumAuthFailedSessionsOutOfMaxAllowed; stats::CounterId kNumActiveSessions; stats::CounterId kNumReclaimedExpiredSessions; -void initCounters() { +void initGraphStats() { kNumQueries = stats::StatsManager::registerStats("num_queries", "rate, sum"); kNumActiveQueries = stats::StatsManager::registerStats("num_active_queries", "sum"); kNumSlowQueries = stats::StatsManager::registerStats("num_slow_queries", "rate, sum"); @@ -74,6 +75,9 @@ void initCounters() { kNumActiveSessions = stats::StatsManager::registerStats("num_active_sessions", "sum"); kNumReclaimedExpiredSessions = stats::StatsManager::registerStats("num_reclaimed_expired_sessions", "rate, sum"); + + initMetaClientStats(); + initStorageClientStats(); } } // namespace nebula diff --git a/src/graph/stats/StatsDef.h b/src/graph/stats/GraphStats.h similarity index 92% rename from src/graph/stats/StatsDef.h rename to src/graph/stats/GraphStats.h index 7c796e834ea..70bb6a1efd1 100644 --- a/src/graph/stats/StatsDef.h +++ b/src/graph/stats/GraphStats.h @@ -3,8 +3,7 @@ * This source code is licensed under Apache 2.0 License. */ -#ifndef GRAPH_STATS_STATSDEF_H_ -#define GRAPH_STATS_STATSDEF_H_ +#pragma once #include "common/base/Base.h" #include "common/stats/StatsManager.h" @@ -45,7 +44,6 @@ extern stats::CounterId kNumAuthFailedSessionsOutOfMaxAllowed; extern stats::CounterId kNumActiveSessions; extern stats::CounterId kNumReclaimedExpiredSessions; -void initCounters(); +void initGraphStats(); } // namespace nebula -#endif // GRAPH_STATS_STATSDEF_H_ diff --git a/src/graph/util/test/CMakeLists.txt b/src/graph/util/test/CMakeLists.txt index 7d3031a5b19..05d1b74119b 100644 --- a/src/graph/util/test/CMakeLists.txt +++ b/src/graph/util/test/CMakeLists.txt @@ -46,7 +46,9 @@ nebula_add_test( $ $ $ - $ + $ + $ + $ LIBRARIES gtest gtest_main diff --git a/src/graph/validator/test/CMakeLists.txt b/src/graph/validator/test/CMakeLists.txt index ab6a41e7fbb..ae4362aee0d 100644 --- a/src/graph/validator/test/CMakeLists.txt +++ b/src/graph/validator/test/CMakeLists.txt @@ -26,7 +26,9 @@ set(VALIDATOR_TEST_LIBS $ $ $ - $ + $ + $ + $ $ $ $ diff --git a/src/graph/visitor/test/CMakeLists.txt b/src/graph/visitor/test/CMakeLists.txt index d84f3d7144a..d3e9d5e2638 100644 --- a/src/graph/visitor/test/CMakeLists.txt +++ b/src/graph/visitor/test/CMakeLists.txt @@ -31,7 +31,9 @@ nebula_add_test( $ $ $ - $ + $ + $ + $ $ $ $ diff --git a/src/kvstore/CMakeLists.txt b/src/kvstore/CMakeLists.txt index ffcc13401ab..549be980087 100644 --- a/src/kvstore/CMakeLists.txt +++ b/src/kvstore/CMakeLists.txt @@ -19,6 +19,7 @@ nebula_add_library( nebula_add_subdirectory(raftex) nebula_add_subdirectory(wal) +nebula_add_subdirectory(stats) nebula_add_subdirectory(test) #nebula_add_subdirectory(plugins) diff --git a/src/kvstore/Part.cpp b/src/kvstore/Part.cpp index f3f2830fcd4..c6416b05c75 100644 --- a/src/kvstore/Part.cpp +++ b/src/kvstore/Part.cpp @@ -5,6 +5,7 @@ #include "kvstore/Part.h" +#include "common/time/ScopedTimer.h" #include "common/utils/IndexKeyUtils.h" #include "common/utils/NebulaKeyUtils.h" #include "common/utils/OperationKeyUtils.h" @@ -213,6 +214,7 @@ void Part::onDiscoverNewLeader(HostAddr nLeader) { } cpp2::ErrorCode Part::commitLogs(std::unique_ptr iter, bool wait) { + SCOPED_TIMER(&execTime_); auto batch = engine_->startBatchWrite(); LogID lastId = -1; TermID lastTerm = -1; @@ -354,6 +356,7 @@ std::pair Part::commitSnapshot(const std::vector& LogID committedLogId, TermID committedLogTerm, bool finished) { + SCOPED_TIMER(&execTime_); auto batch = engine_->startBatchWrite(); int64_t count = 0; int64_t size = 0; diff --git a/src/kvstore/raftex/RaftPart.cpp b/src/kvstore/raftex/RaftPart.cpp index bfa99392102..04600009911 100644 --- a/src/kvstore/raftex/RaftPart.cpp +++ b/src/kvstore/raftex/RaftPart.cpp @@ -14,6 +14,7 @@ #include "common/base/CollectNSucceeded.h" #include "common/base/SlowOpTracker.h" #include "common/network/NetworkUtils.h" +#include "common/stats/StatsManager.h" #include "common/thread/NamedThread.h" #include "common/thrift/ThriftClientManager.h" #include "common/time/WallClock.h" @@ -21,6 +22,7 @@ #include "interface/gen-cpp2/RaftexServiceAsyncClient.h" #include "kvstore/LogEncoder.h" #include "kvstore/raftex/Host.h" +#include "kvstore/stats/KVStats.h" #include "kvstore/wal/FileBasedWal.h" DEFINE_uint32(raft_heartbeat_interval_secs, 5, "Seconds between each heartbeat"); @@ -872,6 +874,7 @@ void RaftPart::processAppendLogResponses(const AppendLogResponses& resps, SlowOpTracker tracker; // Step 3: Commit the batch if (commitLogs(std::move(walIt), true) == nebula::cpp2::ErrorCode::SUCCEEDED) { + stats::StatsManager::addValue(kCommitLogLatencyUs, execTime_); std::lock_guard g(raftLock_); committedLogId_ = lastLogId; firstLogId = lastLogId_ + 1; @@ -1387,6 +1390,7 @@ void RaftPart::processAskForVoteRequest(const cpp2::AskForVoteRequest& req, // Reset the last message time lastMsgRecvDur_.reset(); isBlindFollower_ = false; + stats::StatsManager::addValue(kNumRaftVotes); return; } @@ -1570,6 +1574,7 @@ void RaftPart::processAppendLogRequest(const cpp2::AppendLogRequest& req, // lack of log auto code = commitLogs(wal_->iterator(committedLogId_ + 1, lastLogIdCanCommit), false); if (code == nebula::cpp2::ErrorCode::SUCCEEDED) { + stats::StatsManager::addValue(kCommitLogLatencyUs, execTime_); VLOG(1) << idStr_ << "Follower succeeded committing log " << committedLogId_ + 1 << " to " << lastLogIdCanCommit; committedLogId_ = lastLogIdCanCommit; @@ -1751,6 +1756,7 @@ void RaftPart::processSendSnapshotRequest(const cpp2::SendSnapshotRequest& req, // TODO(heng): Maybe we should save them into one sst firstly? auto ret = commitSnapshot( req.get_rows(), req.get_committed_log_id(), req.get_committed_log_term(), req.get_done()); + stats::StatsManager::addValue(kCommitSnapshotLatencyUs, execTime_); lastTotalCount_ += ret.first; lastTotalSize_ += ret.second; if (lastTotalCount_ != req.get_total_count() || lastTotalSize_ != req.get_total_size()) { diff --git a/src/kvstore/raftex/RaftPart.h b/src/kvstore/raftex/RaftPart.h index 346ab53cee4..4821581acff 100644 --- a/src/kvstore/raftex/RaftPart.h +++ b/src/kvstore/raftex/RaftPart.h @@ -224,6 +224,8 @@ class RaftPart : public std::enable_shared_from_this { // Reset the part, clean up all data and WALs. void reset(); + uint64_t execTime() const { return execTime_; } + protected: // Protected constructor to prevent from instantiating directly RaftPart(ClusterID clusterId, @@ -563,6 +565,9 @@ class RaftPart : public std::enable_shared_from_this { int64_t startTimeMs_ = 0; std::atomic blocking_{false}; + + // For stats info + uint64_t execTime_{0}; }; } // namespace raftex diff --git a/src/kvstore/raftex/RaftexService.cpp b/src/kvstore/raftex/RaftexService.cpp index b1a26f8763c..3506dee52b9 100644 --- a/src/kvstore/raftex/RaftexService.cpp +++ b/src/kvstore/raftex/RaftexService.cpp @@ -8,6 +8,7 @@ #include #include "common/base/Base.h" +#include "common/base/ErrorOr.h" #include "common/ssl/SSLConfig.h" #include "kvstore/raftex/RaftPart.h" diff --git a/src/kvstore/raftex/test/CMakeLists.txt b/src/kvstore/raftex/test/CMakeLists.txt index 40982da8a59..b826c5b36f5 100644 --- a/src/kvstore/raftex/test/CMakeLists.txt +++ b/src/kvstore/raftex/test/CMakeLists.txt @@ -14,6 +14,10 @@ set(RAFTEX_TEST_LIBS $ $ $ + $ + $ + $ + $ ) diff --git a/src/kvstore/stats/CMakeLists.txt b/src/kvstore/stats/CMakeLists.txt new file mode 100644 index 00000000000..ff585725728 --- /dev/null +++ b/src/kvstore/stats/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. + +nebula_add_library( + kv_stats_obj + OBJECT + KVStats.cpp + ) diff --git a/src/kvstore/stats/KVStats.cpp b/src/kvstore/stats/KVStats.cpp new file mode 100644 index 00000000000..6b8996f9b58 --- /dev/null +++ b/src/kvstore/stats/KVStats.cpp @@ -0,0 +1,28 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#include "kvstore/stats/KVStats.h" + +#include "common/base/Base.h" +#include "common/stats/StatsManager.h" + +namespace nebula { + +stats::CounterId kCommitLogLatencyUs; +stats::CounterId kCommitSnapshotLatencyUs; +stats::CounterId kTransferLeaderLatencyUs; +stats::CounterId kNumRaftVotes; + +void initKVStats() { + kCommitLogLatencyUs = stats::StatsManager::registerHisto( + "commit_log_latency_us", 1000, 0, 2000, "avg, p75, p95, p99, p999"); + kCommitSnapshotLatencyUs = stats::StatsManager::registerHisto( + "commit_snapshot_latency_us", 1000, 0, 2000, "avg, p75, p95, p99, p999"); + kTransferLeaderLatencyUs = stats::StatsManager::registerHisto( + "transfer_leader_latency_us", 1000, 0, 2000, "avg, p75, p95, p99, p999"); + kNumRaftVotes = stats::StatsManager::registerStats("num_raft_votes", "rate, sum"); +} + +} // namespace nebula diff --git a/src/kvstore/stats/KVStats.h b/src/kvstore/stats/KVStats.h new file mode 100644 index 00000000000..90da33a5f2a --- /dev/null +++ b/src/kvstore/stats/KVStats.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#pragma once + +#include "common/base/Base.h" +#include "common/stats/StatsManager.h" + +namespace nebula { + +extern stats::CounterId kCommitLogLatencyUs; +extern stats::CounterId kCommitSnapshotLatencyUs; +extern stats::CounterId kTransferLeaderLatencyUs; +extern stats::CounterId kNumRaftVotes; + +void initKVStats(); + +} // namespace nebula diff --git a/src/kvstore/test/CMakeLists.txt b/src/kvstore/test/CMakeLists.txt index cdcb719cf33..97eb868396c 100644 --- a/src/kvstore/test/CMakeLists.txt +++ b/src/kvstore/test/CMakeLists.txt @@ -38,6 +38,10 @@ set(KVSTORE_TEST_LIBS $ $ $ + $ + $ + $ + $ ) nebula_add_test( diff --git a/src/meta/CMakeLists.txt b/src/meta/CMakeLists.txt index 77449574b61..919f6ebacd2 100644 --- a/src/meta/CMakeLists.txt +++ b/src/meta/CMakeLists.txt @@ -160,8 +160,14 @@ set(meta_test_deps $ $ $ + $ + $ + $ + $ + $ ) nebula_add_subdirectory(http) nebula_add_subdirectory(test) nebula_add_subdirectory(upgrade) +nebula_add_subdirectory(stats) diff --git a/src/meta/stats/CMakeLists.txt b/src/meta/stats/CMakeLists.txt new file mode 100644 index 00000000000..91bcf68755d --- /dev/null +++ b/src/meta/stats/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. + +nebula_add_library( + meta_stats_obj + OBJECT + MetaStats.cpp + ) diff --git a/src/meta/stats/MetaStats.cpp b/src/meta/stats/MetaStats.cpp new file mode 100644 index 00000000000..124c72f1b3b --- /dev/null +++ b/src/meta/stats/MetaStats.cpp @@ -0,0 +1,12 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#include "kvstore/stats/KVStats.h" + +namespace nebula { + +void initMetaStats() { initKVStats(); } + +} // namespace nebula diff --git a/src/meta/stats/MetaStats.h b/src/meta/stats/MetaStats.h new file mode 100644 index 00000000000..a8a5fba750e --- /dev/null +++ b/src/meta/stats/MetaStats.h @@ -0,0 +1,14 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#pragma once + +#include "common/stats/StatsManager.h" + +namespace nebula { + +void initMetaStats(); + +} // namespace nebula diff --git a/src/parser/test/CMakeLists.txt b/src/parser/test/CMakeLists.txt index c6fc74dfbf6..755d2c7a350 100644 --- a/src/parser/test/CMakeLists.txt +++ b/src/parser/test/CMakeLists.txt @@ -9,7 +9,9 @@ set(PARSER_TEST_LIBS $ $ $ - $ + $ + $ + $ $ $ $ diff --git a/src/storage/CMakeLists.txt b/src/storage/CMakeLists.txt index 4f263476edc..6e58d6d2815 100644 --- a/src/storage/CMakeLists.txt +++ b/src/storage/CMakeLists.txt @@ -90,4 +90,5 @@ nebula_add_library( StorageServer.cpp ) +nebula_add_subdirectory(stats) nebula_add_subdirectory(test) diff --git a/src/storage/GraphStorageServiceHandler.cpp b/src/storage/GraphStorageServiceHandler.cpp index 8fa037a65eb..7f7f027af5e 100644 --- a/src/storage/GraphStorageServiceHandler.cpp +++ b/src/storage/GraphStorageServiceHandler.cpp @@ -63,12 +63,6 @@ GraphStorageServiceHandler::GraphStorageServiceHandler(StorageEnv* env) : env_(e kPutCounters.init("kv_put"); kGetCounters.init("kv_get"); kRemoveCounters.init("kv_remove"); - - kNumVerticesInserted = stats::StatsManager::registerStats("num_vertices_inserted", "rate, sum"); - kNumEdgesInserted = stats::StatsManager::registerStats("num_edges_inserted", "rate, sum"); - kNumEdgesDeleted = stats::StatsManager::registerStats("num_edges_deleted", "rate, sum"); - kNumTagsDeleted = stats::StatsManager::registerStats("num_tags_deleted", "rate, sum"); - kNumVerticesDeleted = stats::StatsManager::registerStats("num_vertices_deleted", "rate, sum"); } // Vertice section diff --git a/src/storage/admin/AdminProcessor.h b/src/storage/admin/AdminProcessor.h index bd55ef10955..0faceb75abe 100644 --- a/src/storage/admin/AdminProcessor.h +++ b/src/storage/admin/AdminProcessor.h @@ -11,6 +11,7 @@ #include "common/base/Base.h" #include "kvstore/NebulaStore.h" #include "kvstore/Part.h" +#include "kvstore/stats/KVStats.h" #include "storage/BaseProcessor.h" #include "storage/StorageFlags.h" @@ -66,6 +67,7 @@ class TransLeaderProcessor : public BaseProcessor { onFinished(); return; } else if (code == nebula::cpp2::ErrorCode::SUCCEEDED) { + stats::StatsManager::addValue(kTransferLeaderLatencyUs, part->execTime()); // To avoid dead lock, we use another ioThreadPool to check the // leader information. folly::via(folly::getIOExecutor().get(), [this, part, spaceId, partId] { diff --git a/src/storage/mutate/AddEdgesProcessor.cpp b/src/storage/mutate/AddEdgesProcessor.cpp index d39d6e3a6dd..be18e908fc4 100644 --- a/src/storage/mutate/AddEdgesProcessor.cpp +++ b/src/storage/mutate/AddEdgesProcessor.cpp @@ -13,12 +13,12 @@ #include "common/utils/IndexKeyUtils.h" #include "common/utils/NebulaKeyUtils.h" #include "common/utils/OperationKeyUtils.h" +#include "storage/stats/StorageStats.h" namespace nebula { namespace storage { ProcessorCounters kAddEdgesCounters; -stats::CounterId kNumEdgesInserted; void AddEdgesProcessor::process(const cpp2::AddEdgesRequest& req) { spaceId_ = req.get_space_id(); diff --git a/src/storage/mutate/AddEdgesProcessor.h b/src/storage/mutate/AddEdgesProcessor.h index 9495bb0377a..bacc212bd06 100644 --- a/src/storage/mutate/AddEdgesProcessor.h +++ b/src/storage/mutate/AddEdgesProcessor.h @@ -16,7 +16,6 @@ namespace nebula { namespace storage { extern ProcessorCounters kAddEdgesCounters; -extern stats::CounterId kNumEdgesInserted; class AddEdgesProcessor : public BaseProcessor { friend class TransactionManager; diff --git a/src/storage/mutate/AddVerticesProcessor.cpp b/src/storage/mutate/AddVerticesProcessor.cpp index 004e8620058..b80329ca280 100644 --- a/src/storage/mutate/AddVerticesProcessor.cpp +++ b/src/storage/mutate/AddVerticesProcessor.cpp @@ -14,12 +14,12 @@ #include "common/utils/NebulaKeyUtils.h" #include "common/utils/OperationKeyUtils.h" #include "storage/StorageFlags.h" +#include "storage/stats/StorageStats.h" namespace nebula { namespace storage { ProcessorCounters kAddVerticesCounters; -stats::CounterId kNumVerticesInserted; void AddVerticesProcessor::process(const cpp2::AddVerticesRequest& req) { spaceId_ = req.get_space_id(); diff --git a/src/storage/mutate/AddVerticesProcessor.h b/src/storage/mutate/AddVerticesProcessor.h index 295bea0374f..ea8e34b56e4 100644 --- a/src/storage/mutate/AddVerticesProcessor.h +++ b/src/storage/mutate/AddVerticesProcessor.h @@ -16,7 +16,6 @@ namespace nebula { namespace storage { extern ProcessorCounters kAddVerticesCounters; -extern stats::CounterId kNumVerticesInserted; class AddVerticesProcessor : public BaseProcessor { public: diff --git a/src/storage/mutate/DeleteEdgesProcessor.cpp b/src/storage/mutate/DeleteEdgesProcessor.cpp index 06977c4f351..5f10a8e45fc 100644 --- a/src/storage/mutate/DeleteEdgesProcessor.cpp +++ b/src/storage/mutate/DeleteEdgesProcessor.cpp @@ -11,12 +11,12 @@ #include "common/utils/IndexKeyUtils.h" #include "common/utils/NebulaKeyUtils.h" #include "common/utils/OperationKeyUtils.h" +#include "storage/stats/StorageStats.h" namespace nebula { namespace storage { ProcessorCounters kDelEdgesCounters; -stats::CounterId kNumEdgesDeleted; void DeleteEdgesProcessor::process(const cpp2::DeleteEdgesRequest& req) { spaceId_ = req.get_space_id(); diff --git a/src/storage/mutate/DeleteEdgesProcessor.h b/src/storage/mutate/DeleteEdgesProcessor.h index 8bcd7553409..9e240b624f9 100644 --- a/src/storage/mutate/DeleteEdgesProcessor.h +++ b/src/storage/mutate/DeleteEdgesProcessor.h @@ -14,7 +14,6 @@ namespace nebula { namespace storage { extern ProcessorCounters kDelEdgesCounters; -extern stats::CounterId kNumEdgesDeleted; class DeleteEdgesProcessor : public BaseProcessor { public: diff --git a/src/storage/mutate/DeleteTagsProcessor.cpp b/src/storage/mutate/DeleteTagsProcessor.cpp index 51d544a621a..03e978bd709 100644 --- a/src/storage/mutate/DeleteTagsProcessor.cpp +++ b/src/storage/mutate/DeleteTagsProcessor.cpp @@ -10,12 +10,12 @@ #include "common/utils/NebulaKeyUtils.h" #include "common/utils/OperationKeyUtils.h" #include "storage/StorageFlags.h" +#include "storage/stats/StorageStats.h" namespace nebula { namespace storage { ProcessorCounters kDelTagsCounters; -stats::CounterId kNumTagsDeleted; void DeleteTagsProcessor::process(const cpp2::DeleteTagsRequest& req) { spaceId_ = req.get_space_id(); diff --git a/src/storage/mutate/DeleteTagsProcessor.h b/src/storage/mutate/DeleteTagsProcessor.h index 37128a3cea8..5c473f16b66 100644 --- a/src/storage/mutate/DeleteTagsProcessor.h +++ b/src/storage/mutate/DeleteTagsProcessor.h @@ -15,7 +15,6 @@ namespace nebula { namespace storage { extern ProcessorCounters kDelTagsCounters; -extern stats::CounterId kNumTagsDeleted; class DeleteTagsProcessor : public BaseProcessor { public: diff --git a/src/storage/mutate/DeleteVerticesProcessor.cpp b/src/storage/mutate/DeleteVerticesProcessor.cpp index 32b732efbd9..e550fae5350 100644 --- a/src/storage/mutate/DeleteVerticesProcessor.cpp +++ b/src/storage/mutate/DeleteVerticesProcessor.cpp @@ -9,12 +9,12 @@ #include "common/utils/NebulaKeyUtils.h" #include "common/utils/OperationKeyUtils.h" #include "storage/StorageFlags.h" +#include "storage/stats/StorageStats.h" namespace nebula { namespace storage { ProcessorCounters kDelVerticesCounters; -stats::CounterId kNumVerticesDeleted; void DeleteVerticesProcessor::process(const cpp2::DeleteVerticesRequest& req) { spaceId_ = req.get_space_id(); diff --git a/src/storage/mutate/DeleteVerticesProcessor.h b/src/storage/mutate/DeleteVerticesProcessor.h index be326819fa9..a5ec2f0b678 100644 --- a/src/storage/mutate/DeleteVerticesProcessor.h +++ b/src/storage/mutate/DeleteVerticesProcessor.h @@ -15,7 +15,6 @@ namespace nebula { namespace storage { extern ProcessorCounters kDelVerticesCounters; -extern stats::CounterId kNumVerticesDeleted; class DeleteVerticesProcessor : public BaseProcessor { public: diff --git a/src/storage/stats/CMakeLists.txt b/src/storage/stats/CMakeLists.txt new file mode 100644 index 00000000000..6d5db5f3f4f --- /dev/null +++ b/src/storage/stats/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (c) 2021 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. + +nebula_add_library( + storage_stats_obj + OBJECT + StorageStats.cpp + ) diff --git a/src/storage/stats/StorageStats.cpp b/src/storage/stats/StorageStats.cpp new file mode 100644 index 00000000000..40f5181c195 --- /dev/null +++ b/src/storage/stats/StorageStats.cpp @@ -0,0 +1,28 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#include "clients/meta/stats/MetaClientStats.h" +#include "kvstore/stats/KVStats.h" + +namespace nebula { + +stats::CounterId kNumEdgesInserted; +stats::CounterId kNumVerticesInserted; +stats::CounterId kNumEdgesDeleted; +stats::CounterId kNumTagsDeleted; +stats::CounterId kNumVerticesDeleted; + +void initStorageStats() { + kNumEdgesInserted = stats::StatsManager::registerStats("num_edges_inserted", "rate, sum"); + kNumVerticesInserted = stats::StatsManager::registerStats("num_vertices_inserted", "rate, sum"); + kNumEdgesDeleted = stats::StatsManager::registerStats("num_edges_deleted", "rate, sum"); + kNumTagsDeleted = stats::StatsManager::registerStats("num_tags_deleted", "rate, sum"); + kNumVerticesDeleted = stats::StatsManager::registerStats("num_vertices_deleted", "rate, sum"); + + initMetaClientStats(); + initKVStats(); +} + +} // namespace nebula diff --git a/src/storage/stats/StorageStats.h b/src/storage/stats/StorageStats.h new file mode 100644 index 00000000000..11bf1a76315 --- /dev/null +++ b/src/storage/stats/StorageStats.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2021 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License. + */ + +#pragma once + +#include "common/stats/StatsManager.h" + +namespace nebula { + +extern stats::CounterId kNumEdgesInserted; +extern stats::CounterId kNumVerticesInserted; +extern stats::CounterId kNumEdgesDeleted; +extern stats::CounterId kNumTagsDeleted; +extern stats::CounterId kNumVerticesDeleted; + +void initStorageStats(); + +} // namespace nebula diff --git a/src/storage/test/CMakeLists.txt b/src/storage/test/CMakeLists.txt index 2c6e0ea5a3c..3d8363f6a2a 100644 --- a/src/storage/test/CMakeLists.txt +++ b/src/storage/test/CMakeLists.txt @@ -52,6 +52,10 @@ set(storage_test_deps $ $ $ + $ + $ + $ + $ ) nebula_add_test( diff --git a/src/tools/db-dump/CMakeLists.txt b/src/tools/db-dump/CMakeLists.txt index a90c14639ed..80919a420a6 100644 --- a/src/tools/db-dump/CMakeLists.txt +++ b/src/tools/db-dump/CMakeLists.txt @@ -34,6 +34,10 @@ set(tools_test_deps $ $ $ + $ + $ + $ + $ $ $ $ diff --git a/src/tools/db-upgrade/CMakeLists.txt b/src/tools/db-upgrade/CMakeLists.txt index 3a5985fa4dd..2f4bbdbee17 100644 --- a/src/tools/db-upgrade/CMakeLists.txt +++ b/src/tools/db-upgrade/CMakeLists.txt @@ -42,6 +42,10 @@ nebula_add_executable( $ $ $ + $ + $ + $ + $ $ $ $ diff --git a/src/tools/meta-dump/CMakeLists.txt b/src/tools/meta-dump/CMakeLists.txt index 37a804eac3e..466b91ef62d 100644 --- a/src/tools/meta-dump/CMakeLists.txt +++ b/src/tools/meta-dump/CMakeLists.txt @@ -39,6 +39,10 @@ nebula_add_executable( $ $ $ + $ + $ + $ + $ $ $ $ diff --git a/src/tools/simple-kv-verify/CMakeLists.txt b/src/tools/simple-kv-verify/CMakeLists.txt index e5c95581711..81de926c583 100644 --- a/src/tools/simple-kv-verify/CMakeLists.txt +++ b/src/tools/simple-kv-verify/CMakeLists.txt @@ -38,6 +38,10 @@ nebula_add_executable( $ $ $ + $ + $ + $ + $ $ $ $ diff --git a/src/tools/storage-perf/CMakeLists.txt b/src/tools/storage-perf/CMakeLists.txt index 5bff542fca6..41f9b0a18a5 100644 --- a/src/tools/storage-perf/CMakeLists.txt +++ b/src/tools/storage-perf/CMakeLists.txt @@ -34,6 +34,10 @@ set(perf_test_deps $ $ $ + $ + $ + $ + $ $ $ $