From 012f4f66023ba7b794508e10faceec74056ba952 Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Fri, 13 Nov 2020 20:16:22 +0600 Subject: TFE 适配 fieldstat prometheus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/src/proxy.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'platform/src/proxy.cpp') 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(); -- cgit v1.2.3