diff --git a/common/src/tfe_future.cpp b/common/src/tfe_future.cpp index 922eadc..6512a66 100644 --- a/common/src/tfe_future.cpp +++ b/common/src/tfe_future.cpp @@ -19,6 +19,7 @@ struct future_promise_instance long long f_num; int no_stats; int statsd_cycle; + int statsd_format; MESA_htable_handle name_table; char statsd_server_ip[256]; int statsd_server_port; @@ -74,6 +75,8 @@ void future_promise_library_init(const char* profile) g_FP_instance.statsd_server_ip, sizeof(g_FP_instance.statsd_server_ip), ""); MESA_load_profile_int_def(profile, "STAT", "statsd_port", &(g_FP_instance.statsd_server_port), 0); MESA_load_profile_int_def(profile, "STAT", "statsd_cycle", &(g_FP_instance.statsd_cycle), 2); + // FS_OUTPUT_STATSD=1, FS_OUTPUT_INFLUX_LINE=2 + MESA_load_profile_int_def(profile, "STAT", "statsd_format", &(g_FP_instance.statsd_format), 1); MESA_load_profile_string_def(profile, "STAT", "histogram_bins", g_FP_instance.histogram_bins, sizeof(g_FP_instance.histogram_bins), FP_HISTOGRAM_BINS); MESA_load_profile_int_def(profile, "STAT", "print_diff", @@ -89,6 +92,10 @@ void future_promise_library_init(const char* profile) return; } + if (g_FP_instance.statsd_format != 1 && g_FP_instance.statsd_format != 2) + { + g_FP_instance.statsd_format = 1; + } MESA_htable_handle htable = MESA_htable_born(); value=0; @@ -119,6 +126,7 @@ void future_promise_library_init(const char* profile) { FS_set_para(fs, STATS_SERVER_IP, g_FP_instance.statsd_server_ip, strlen(g_FP_instance.statsd_server_ip)+1); FS_set_para(fs, STATS_SERVER_PORT, &(g_FP_instance.statsd_server_port), sizeof(g_FP_instance.statsd_server_port)); + FS_set_para(fs, STATS_FORMAT, &(g_FP_instance.statsd_format), sizeof(g_FP_instance.statsd_format)); } FS_set_para(fs, HISTOGRAM_GLOBAL_BINS, g_FP_instance.histogram_bins, strlen(g_FP_instance.histogram_bins)+1); g_FP_instance.fsid_f_num=FS_register(fs, FS_STYLE_FIELD, g_FP_instance.favorite, "futures"); diff --git a/conf/tfe/future.conf b/conf/tfe/future.conf index 817aa66..c1b6059 100644 --- a/conf/tfe/future.conf +++ b/conf/tfe/future.conf @@ -3,4 +3,6 @@ no_stats=0 statsd_server=192.168.10.72 statsd_port=8092 histogram_bins=0.50,0.80,0.9,0.95 -statsd_cycle=2 \ No newline at end of file +statsd_cycle=2 +# FS_OUTPUT_STATSD=1, FS_OUTPUT_INFLUX_LINE=2 +statsd_format=1 diff --git a/conf/tfe/tfe.conf b/conf/tfe/tfe.conf index d8f8717..1ca97ea 100644 --- a/conf/tfe/tfe.conf +++ b/conf/tfe/tfe.conf @@ -72,6 +72,8 @@ level=10 statsd_server=192.168.10.72 statsd_port=8126 statsd_cycle=2 +# FS_OUTPUT_STATSD=1, FS_OUTPUT_INFLUX_LINE=2 +statsd_format=1 [http] loglevel=20 diff --git a/platform/src/proxy.cpp b/platform/src/proxy.cpp index 4b3eac5..9d11484 100644 --- a/platform/src/proxy.cpp +++ b/platform/src/proxy.cpp @@ -346,13 +346,21 @@ int tfe_stat_init(struct tfe_proxy * proxy, const char * profile) screen_stat_handle_t fs_handle = NULL; char statsd_server_ip[TFE_SYMBOL_MAX]={0}; char histogram_bins[TFE_SYMBOL_MAX]={0}; + int statsd_format=0; int statsd_server_port=0; MESA_load_profile_string_def(profile, "STAT", "statsd_server", statsd_server_ip, sizeof(statsd_server_ip), ""); MESA_load_profile_int_def(profile, "STAT", "statsd_port", &(statsd_server_port), 0); + // FS_OUTPUT_STATSD=1, FS_OUTPUT_INFLUX_LINE=2 + MESA_load_profile_int_def(profile, "STAT", "statsd_format", &(statsd_format), 1); MESA_load_profile_string_def(profile, "STAT", "histogram_bins", histogram_bins, sizeof(histogram_bins), "0.5,0.8,0.9,0.95"); + if (statsd_format != 1 && statsd_format != 2) + { + statsd_format = 1; + } + 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); @@ -365,6 +373,7 @@ int tfe_stat_init(struct tfe_proxy * proxy, const char * profile) { FS_set_para(fs_handle, STATS_SERVER_IP, statsd_server_ip, strlen(statsd_server_ip)+1); FS_set_para(fs_handle, STATS_SERVER_PORT, &(statsd_server_port), sizeof(statsd_server_port)); + FS_set_para(fs_handle, STATS_FORMAT, &statsd_format, sizeof(statsd_format)); } FS_set_para(fs_handle, HISTOGRAM_GLOBAL_BINS, histogram_bins, strlen(histogram_bins)+1);