summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2020-11-13 20:16:22 +0600
committerluwenpeng <[email protected]>2020-11-13 20:55:56 +0600
commit012f4f66023ba7b794508e10faceec74056ba952 (patch)
treec7260d76ebe6311a1ddbc0db762a20844c432f68
parent111f5fc4dc229574268e5a9580b815b7afd8269c (diff)
TFE 适配 fieldstat prometheusv4.3.21-202011
-rw-r--r--common/src/tfe_future.cpp2
-rw-r--r--conf/tfe/tfe.conf2
-rw-r--r--platform/src/proxy.cpp11
3 files changed, 14 insertions, 1 deletions
diff --git a/common/src/tfe_future.cpp b/common/src/tfe_future.cpp
index 6512a66..32afd04 100644
--- a/common/src/tfe_future.cpp
+++ b/common/src/tfe_future.cpp
@@ -114,6 +114,8 @@ void future_promise_library_init(const char* profile)
const char* app_name="FP";
fs=FS_create_handle();
FS_set_para(fs, APP_NAME, app_name, strlen(app_name)+1);
+ value=1;
+ FS_set_para(fs, OUTPUT_PROMETHEUS, &value, sizeof(value));
value=0;
FS_set_para(fs, FLUSH_BY_DATE, &value, sizeof(value));
FS_set_para(fs, OUTPUT_DEVICE, stat_path, strlen(stat_path)+1);
diff --git a/conf/tfe/tfe.conf b/conf/tfe/tfe.conf
index 1f0ab0e..7a1a621 100644
--- a/conf/tfe/tfe.conf
+++ b/conf/tfe/tfe.conf
@@ -134,6 +134,8 @@ statsd_cycle=5
# 1:FS_OUTPUT_STATSD; 2:FS_OUTPUT_INFLUX_LINE
statsd_format=2
histogram_bins=0.5,0.8,0.9,0.95
+statsd_set_prometheus_port=9001
+statsd_set_prometheus_url_path=/tfe_prometheus
[traffic_mirror]
enable=1
diff --git a/platform/src/proxy.cpp b/platform/src/proxy.cpp
index 528d5ea..f683415 100644
--- a/platform/src/proxy.cpp
+++ b/platform/src/proxy.cpp
@@ -453,7 +453,8 @@ int tfe_stat_init(struct tfe_proxy * proxy, const char * profile)
fs_handle = FS_create_handle();
FS_set_para(fs_handle, OUTPUT_DEVICE, fieldstat_output, (int)strlen(fieldstat_output) + 1);
FS_set_para(fs_handle, APP_NAME, app_name, (int)strlen(app_name) + 1);
-
+ value = 1;
+ FS_set_para(fs_handle, OUTPUT_PROMETHEUS, &value, sizeof(value));
value = 1;
FS_set_para(fs_handle, PRINT_MODE, &value, sizeof(value));
value = 0;
@@ -555,6 +556,14 @@ int main(int argc, char * argv[])
breakpad_segv_generate();
}
+ int prometheus_port = 9001;
+ char prometheus_url_path[1024] = {0};
+ MESA_load_profile_int_def(main_profile, "STAT", "statsd_set_prometheus_port", &(prometheus_port), 9001);
+ MESA_load_profile_string_def(main_profile, "STAT", "statsd_set_prometheus_url_path", prometheus_url_path, sizeof(prometheus_url_path), "/tfe_prometheus");
+ FS_library_set_prometheus_port(prometheus_port);
+ FS_library_set_prometheus_url_path(prometheus_url_path);
+ FS_library_init();
+
future_promise_library_init(future_profile);
tango_cache_global_init();