#44 tfe和cache的FieldStat2输出到statsd server.

This commit is contained in:
zhengchao
2018-11-23 09:40:42 +08:00
parent 369bdebbad
commit 88849c9890
2 changed files with 34 additions and 6 deletions

View File

@@ -279,8 +279,15 @@ int tfe_stat_init(struct tfe_proxy * proxy, const char * profile)
int value = 0, i = 0;
screen_stat_handle_t fs_handle = NULL;
char statsd_server_ip[TFE_SYMBOL_MAX];
char histogram_bins[TFE_SYMBOL_MAX];
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);
MESA_load_profile_string_def(profile, "STAT", "histogram_bins",
histogram_bins, sizeof(histogram_bins), "0.5,0.8,0.9,0.95");
/* TODO: Read Stat-D server and port from 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);
@@ -289,6 +296,12 @@ int tfe_stat_init(struct tfe_proxy * proxy, const char * profile)
FS_set_para(fs_handle, PRINT_MODE, &value, sizeof(value));
value = 0;
FS_set_para(fs_handle, CREATE_THREAD, &value, sizeof(value));
if(strlen(statsd_server_ip)>0 && statsd_server_port!=0)
{
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, HISTOGRAM_GLOBAL_BINS, histogram_bins, strlen(histogram_bins)+1);
for (i = 0; i < TFE_STAT_MAX; i++)
{