Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
bf0e5cbc
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bf0e5cbc
编写于
11月 14, 2019
作者:
Z
Zhiru Zhu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add option to disable/enble prometheus when compiling
上级
bbb1ed42
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
70 addition
and
27 deletion
+70
-27
core/CMakeLists.txt
core/CMakeLists.txt
+18
-14
core/src/CMakeLists.txt
core/src/CMakeLists.txt
+24
-4
core/src/metrics/Metrics.cpp
core/src/metrics/Metrics.cpp
+7
-1
core/src/metrics/prometheus/PrometheusMetrics.cpp
core/src/metrics/prometheus/PrometheusMetrics.cpp
+2
-2
core/src/metrics/prometheus/PrometheusMetrics.h
core/src/metrics/prometheus/PrometheusMetrics.h
+1
-1
core/unittest/CMakeLists.txt
core/unittest/CMakeLists.txt
+7
-3
core/unittest/metrics/CMakeLists.txt
core/unittest/metrics/CMakeLists.txt
+10
-1
core/unittest/metrics/test_prometheus.cpp
core/unittest/metrics/test_prometheus.cpp
+1
-1
未找到文件。
core/CMakeLists.txt
浏览文件 @
bf0e5cbc
...
@@ -33,7 +33,7 @@ message(STATUS "Build time = ${BUILD_TIME}")
...
@@ -33,7 +33,7 @@ message(STATUS "Build time = ${BUILD_TIME}")
MACRO
(
GET_GIT_BRANCH_NAME GIT_BRANCH_NAME
)
MACRO
(
GET_GIT_BRANCH_NAME GIT_BRANCH_NAME
)
execute_process
(
COMMAND sh
"-c"
"git log --decorate | head -n 1 | sed 's/.*(
\\
(.*
\\
))/
\\
1/' | sed 's/.*
\\
(.*
\\
),.*/
\\
1/' | sed 's=[a-zA-Z]*\/==g'"
execute_process
(
COMMAND sh
"-c"
"git log --decorate | head -n 1 | sed 's/.*(
\\
(.*
\\
))/
\\
1/' | sed 's/.*
\\
(.*
\\
),.*/
\\
1/' | sed 's=[a-zA-Z]*\/==g'"
OUTPUT_VARIABLE
${
GIT_BRANCH_NAME
}
)
OUTPUT_VARIABLE
${
GIT_BRANCH_NAME
}
)
ENDMACRO
(
GET_GIT_BRANCH_NAME
)
ENDMACRO
(
GET_GIT_BRANCH_NAME
)
GET_GIT_BRANCH_NAME
(
GIT_BRANCH_NAME
)
GET_GIT_BRANCH_NAME
(
GIT_BRANCH_NAME
)
...
@@ -117,17 +117,17 @@ include(DefineOptions)
...
@@ -117,17 +117,17 @@ include(DefineOptions)
include
(
BuildUtils
)
include
(
BuildUtils
)
include
(
ThirdPartyPackages
)
include
(
ThirdPartyPackages
)
if
(
MILVUS_USE_CCACHE
)
if
(
MILVUS_USE_CCACHE
)
find_program
(
CCACHE_FOUND ccache
)
find_program
(
CCACHE_FOUND ccache
)
if
(
CCACHE_FOUND
)
if
(
CCACHE_FOUND
)
message
(
STATUS
"Using ccache:
${
CCACHE_FOUND
}
"
)
message
(
STATUS
"Using ccache:
${
CCACHE_FOUND
}
"
)
set_property
(
GLOBAL PROPERTY RULE_LAUNCH_COMPILE
${
CCACHE_FOUND
}
)
set_property
(
GLOBAL PROPERTY RULE_LAUNCH_COMPILE
${
CCACHE_FOUND
}
)
set_property
(
GLOBAL PROPERTY RULE_LAUNCH_LINK
${
CCACHE_FOUND
}
)
set_property
(
GLOBAL PROPERTY RULE_LAUNCH_LINK
${
CCACHE_FOUND
}
)
# let ccache preserve C++ comments, because some of them may be
# let ccache preserve C++ comments, because some of them may be
# meaningful to the compiler
# meaningful to the compiler
set
(
ENV{CCACHE_COMMENTS}
"1"
)
set
(
ENV{CCACHE_COMMENTS}
"1"
)
endif
(
CCACHE_FOUND
)
endif
(
CCACHE_FOUND
)
endif
()
endif
()
set
(
MILVUS_CPU_VERSION false
)
set
(
MILVUS_CPU_VERSION false
)
if
(
MILVUS_GPU_VERSION
)
if
(
MILVUS_GPU_VERSION
)
...
@@ -142,6 +142,10 @@ else ()
...
@@ -142,6 +142,10 @@ else ()
add_compile_definitions
(
"MILVUS_CPU_VERSION"
)
add_compile_definitions
(
"MILVUS_CPU_VERSION"
)
endif
()
endif
()
if
(
MILVUS_WITH_PROMETHEUS
)
add_compile_definitions
(
"MILVUS_WITH_PROMETHEUS"
)
endif
()
if
(
CMAKE_BUILD_TYPE STREQUAL
"Release"
)
if
(
CMAKE_BUILD_TYPE STREQUAL
"Release"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-O3 -fPIC -DELPP_THREAD_SAFE -fopenmp"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-O3 -fPIC -DELPP_THREAD_SAFE -fopenmp"
)
if
(
MILVUS_GPU_VERSION
)
if
(
MILVUS_GPU_VERSION
)
...
@@ -176,9 +180,9 @@ endif ()
...
@@ -176,9 +180,9 @@ endif ()
if
(
MILVUS_GPU_VERSION
)
if
(
MILVUS_GPU_VERSION
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/server_gpu_config.template
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/server_config.yaml
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/server_gpu_config.template
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/server_config.yaml
)
else
()
else
()
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/server_cpu_config.template
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/server_config.yaml
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/server_cpu_config.template
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/server_config.yaml
)
endif
()
endif
()
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/log_config.template
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/log_config.conf
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/log_config.template
${
CMAKE_CURRENT_SOURCE_DIR
}
/conf/log_config.conf
)
...
...
core/src/CMakeLists.txt
浏览文件 @
bf0e5cbc
...
@@ -37,6 +37,7 @@ endforeach ()
...
@@ -37,6 +37,7 @@ endforeach ()
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/cache cache_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/cache cache_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/config config_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/config config_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/metrics metrics_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/metrics metrics_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/metrics/prometheus metrics_prometheus_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/db db_main_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/db db_main_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/db/engine db_engine_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/db/engine db_engine_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/db/insert db_insert_files
)
aux_source_directory
(
${
MILVUS_ENGINE_SRC
}
/db/insert db_insert_files
)
...
@@ -91,6 +92,11 @@ set(engine_files
...
@@ -91,6 +92,11 @@ set(engine_files
${
wrapper_files
}
${
wrapper_files
}
)
)
if
(
MILVUS_WITH_PROMETHEUS
)
set
(
engine_files
${
engine_files
}
${
metrics_prometheus_files
}
)
endif
()
set
(
client_grpc_lib
set
(
client_grpc_lib
grpcpp_channelz
grpcpp_channelz
grpc++
grpc++
...
@@ -115,7 +121,6 @@ set(third_party_libs
...
@@ -115,7 +121,6 @@ set(third_party_libs
sqlite
sqlite
${
client_grpc_lib
}
${
client_grpc_lib
}
yaml-cpp
yaml-cpp
${
prometheus_lib
}
mysqlpp
mysqlpp
zlib
zlib
${
boost_lib
}
${
boost_lib
}
...
@@ -138,13 +143,19 @@ if (MILVUS_GPU_VERSION)
...
@@ -138,13 +143,19 @@ if (MILVUS_GPU_VERSION)
)
)
endif
()
endif
()
if
(
MILVUS_ENABLE_PROFILING
STREQUAL
"ON"
)
if
(
MILVUS_ENABLE_PROFILING
)
set
(
third_party_libs
${
third_party_libs
}
set
(
third_party_libs
${
third_party_libs
}
gperftools
gperftools
libunwind
libunwind
)
)
endif
()
endif
()
if
(
MILVUS_WITH_PROMETHEUS
)
set
(
third_party_libs
${
third_party_libs
}
${
prometheus_lib
}
)
endif
()
set
(
engine_libs
set
(
engine_libs
pthread
pthread
libgomp.a
libgomp.a
...
@@ -166,13 +177,22 @@ target_link_libraries(milvus_engine
...
@@ -166,13 +177,22 @@ target_link_libraries(milvus_engine
${
engine_libs
}
${
engine_libs
}
)
)
add_library
(
metrics STATIC
${
metrics_files
}
)
if
(
MILVUS_WITH_PROMETHEUS
)
add_library
(
metrics STATIC
${
metrics_files
}
${
metrics_prometheus_files
}
)
else
()
add_library
(
metrics STATIC
${
metrics_files
}
)
endif
()
set
(
metrics_lib
set
(
metrics_lib
yaml-cpp
yaml-cpp
${
prometheus_lib
}
)
)
if
(
MILVUS_WITH_PROMETHEUS
)
set
(
metrics_lib
${
metrics_lib
}
${
prometheus_lib
}
)
endif
()
target_link_libraries
(
metrics
${
metrics_lib
}
)
target_link_libraries
(
metrics
${
metrics_lib
}
)
set
(
server_libs
set
(
server_libs
...
...
core/src/metrics/Metrics.cpp
浏览文件 @
bf0e5cbc
...
@@ -16,8 +16,10 @@
...
@@ -16,8 +16,10 @@
// under the License.
// under the License.
#include "metrics/Metrics.h"
#include "metrics/Metrics.h"
#include "PrometheusMetrics.h"
#include "server/Config.h"
#include "server/Config.h"
#ifdef MILVUS_WITH_PROMETHEUS
#include "metrics/prometheus/PrometheusMetrics.h"
#endif
#include <string>
#include <string>
...
@@ -37,11 +39,15 @@ Metrics::CreateMetricsCollector() {
...
@@ -37,11 +39,15 @@ Metrics::CreateMetricsCollector() {
config
.
GetMetricConfigCollector
(
collector_type_str
);
config
.
GetMetricConfigCollector
(
collector_type_str
);
#ifdef MILVUS_WITH_PROMETHEUS
if
(
collector_type_str
==
"prometheus"
)
{
if
(
collector_type_str
==
"prometheus"
)
{
return
PrometheusMetrics
::
GetInstance
();
return
PrometheusMetrics
::
GetInstance
();
}
else
{
}
else
{
return
MetricsBase
::
GetInstance
();
return
MetricsBase
::
GetInstance
();
}
}
#else
return
MetricsBase
::
GetInstance
();
#endif
}
}
}
// namespace server
}
// namespace server
...
...
core/src/metrics/PrometheusMetrics.cpp
→
core/src/metrics/
prometheus/
PrometheusMetrics.cpp
浏览文件 @
bf0e5cbc
...
@@ -15,10 +15,10 @@
...
@@ -15,10 +15,10 @@
// specific language governing permissions and limitations
// specific language governing permissions and limitations
// under the License.
// under the License.
#include "metrics/PrometheusMetrics.h"
#include "PrometheusMetrics.h"
#include "SystemInfo.h"
#include "cache/GpuCacheMgr.h"
#include "cache/GpuCacheMgr.h"
#include "server/Config.h"
#include "server/Config.h"
#include "metrics/SystemInfo.h"
#include "utils/Log.h"
#include "utils/Log.h"
#include <string>
#include <string>
...
...
core/src/metrics/PrometheusMetrics.h
→
core/src/metrics/
prometheus/
PrometheusMetrics.h
浏览文件 @
bf0e5cbc
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#include <string>
#include <string>
#include <vector>
#include <vector>
#include "MetricBase.h"
#include "
metrics/
MetricBase.h"
#include "utils/Error.h"
#include "utils/Error.h"
#define METRICS_NOW_TIME std::chrono::system_clock::now()
#define METRICS_NOW_TIME std::chrono::system_clock::now()
...
...
core/unittest/CMakeLists.txt
浏览文件 @
bf0e5cbc
...
@@ -110,12 +110,16 @@ set(unittest_libs
...
@@ -110,12 +110,16 @@ set(unittest_libs
pthread
pthread
metrics
metrics
gfortran
gfortran
prometheus-cpp-pull
prometheus-cpp-push
prometheus-cpp-core
dl
dl
z
z
)
)
if
(
MILVUS_WITH_PROMETHEUS
)
set
(
unittest_libs
${
unittest_libs
}
prometheus-cpp-push
prometheus-cpp-pull
prometheus-cpp-core
)
endif
()
if
(
MILVUS_GPU_VERSION
)
if
(
MILVUS_GPU_VERSION
)
include_directories
(
"
${
CUDA_INCLUDE_DIRS
}
"
)
include_directories
(
"
${
CUDA_INCLUDE_DIRS
}
"
)
...
...
core/unittest/metrics/CMakeLists.txt
浏览文件 @
bf0e5cbc
...
@@ -17,7 +17,16 @@
...
@@ -17,7 +17,16 @@
# under the License.
# under the License.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
test_files
)
set
(
test_files
test_metricbase.cpp
test_metrics.cpp
utils.cpp
)
if
(
MILVUS_WITH_PROMETHEUS
)
set
(
test_files
${
test_files
}
test_prometheus.cpp
)
endif
()
add_executable
(
test_metrics
add_executable
(
test_metrics
${
common_files
}
${
common_files
}
...
...
core/unittest/metrics/test_prometheus.cpp
浏览文件 @
bf0e5cbc
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// specific language governing permissions and limitations
// under the License.
// under the License.
#include "metrics/PrometheusMetrics.h"
#include "server/Config.h"
#include "server/Config.h"
#include "metrics/prometheus/PrometheusMetrics.h"
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <iostream>
#include <iostream>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录