Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prometheus for monitor #368

Merged
merged 18 commits into from
Aug 6, 2019
Merged

add prometheus for monitor #368

merged 18 commits into from
Aug 6, 2019

Conversation

ChenQShmily
Copy link
Contributor

@ChenQShmily ChenQShmily commented Aug 1, 2019

add perf_counter_enable_prometheus, prometheus_host,prometheus_port to config.ini
perf_counter_enable_prometheus : whether to use prometheus to report data
prometheus_host : the host that pushgateway running
prometheus_port : the port pushgateway use

add _enable_prometheus, _prometheus_host, _prometheus_port to pegasus_counter_reporter.h, receive the data from config.ini

pegasus_counter_reporter.cpp
s_split(): split metrics_names that look like ***:1_0_p999, add app_id, partition_count and percent to metrics_labels SO there can have more classification methods to monitor

update()
if(_enable_prometheus){
change_metrics_name()
prometheus don't accept the format cs.name use, so use the temporary variable metrics_name to hold the right name; change such as "collectorapp.pegasusapp.stat.multi_put_qps@1.0_p999" to "collector_app_pegasus_app_stat_multi_put_qps:1_0_p999"

line 245-260
split metrics_name like "collector_app_pegasus_app_stat_multi_put_qps:1_0_p999", then get "app_id = 1","partition_count = 0","percent = p999" as metrics_labels

line 262-270
create metrics that prometheus support to hold data, add data_labels and set data_value

line 274-275
push the metrics to pushgateway
pushgateway can push data to prometheus automatically
}

Configuration updates:

[pegasus.server]
perf_counter_enable_prometheus = false
prometheus_host = 127.0.0.1
prometheus_port = 9091

src/redis_protocol/proxy/CMakeLists.txt Outdated Show resolved Hide resolved
src/redis_protocol/proxy_lib/CMakeLists.txt Outdated Show resolved Hide resolved
src/reporter/pegasus_counter_reporter.cpp Outdated Show resolved Hide resolved
src/reporter/pegasus_counter_reporter.cpp Outdated Show resolved Hide resolved
src/reporter/pegasus_counter_reporter.cpp Outdated Show resolved Hide resolved
src/reporter/pegasus_counter_reporter.cpp Outdated Show resolved Hide resolved
src/reporter/pegasus_counter_reporter.cpp Outdated Show resolved Hide resolved
src/reporter/pegasus_counter_reporter.h Outdated Show resolved Hide resolved
src/server/CMakeLists.txt Outdated Show resolved Hide resolved
src/server/test/CMakeLists.txt Outdated Show resolved Hide resolved
@acelyc111
Copy link
Member

已修改的点下resolve标记一下

src/reporter/CMakeLists.txt Outdated Show resolved Hide resolved
src/reporter/CMakeLists.txt Outdated Show resolved Hide resolved
src/reporter/CMakeLists.txt Outdated Show resolved Hide resolved
src/reporter/pegasus_counter_reporter.cpp Outdated Show resolved Hide resolved
@vagetablechicken
Copy link
Contributor

link_libraries()因为是全局的,会干扰其他project的链接,而且link_libraries()有比较奇怪的行为。
具体来说,link_libraries()在使用上有不符合预期的输出。即使写法为"libxxx.a","libxxx.so",也并不能指定库类型,cmake会将link改为-lxxx。于是从g++编译器角度,这既可以是静态库也可以是动态库。
当其参数为相对路径时,不会产生my_proj_EXTERNAL_OBJECTS,即"External object files for target pegasus_rproxy"。
而当参数为绝对路径时,my_proj_EXTERNAL_OBJECTS会添加该库的绝对路径,这个target实际又不存在,make就会报错make[2]: *** No rule to make target

综上,这个pr和以后的CMake重构中都要完全避免用link_libraries()这个函数。

src/reporter/CMakeLists.txt Outdated Show resolved Hide resolved
@hycdong hycdong merged commit 7a598fc into apache:master Aug 6, 2019
@neverchanje neverchanje mentioned this pull request Oct 29, 2019
acelyc111 pushed a commit that referenced this pull request Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants