优化fieldstat3句柄创建
This commit is contained in:
@@ -662,21 +662,6 @@ static void doh_process_req(const struct tfe_stream *stream, const struct tfe_ht
|
||||
}
|
||||
}
|
||||
|
||||
struct tfe_fieldstat_metric_t *doh_fieldstat_init(const char* profile, const char *section, int max_thread)
|
||||
{
|
||||
int cycle=0;
|
||||
unsigned short telegraf_port=0;
|
||||
char telegraf_ip[TFE_STRING_MAX]={0};
|
||||
char app_name[TFE_STRING_MAX]={0};
|
||||
|
||||
MESA_load_profile_short_nodef(profile, section, "telegraf_port", (short *)&(telegraf_port));
|
||||
MESA_load_profile_string_nodef(profile, section, "telegraf_ip", telegraf_ip, sizeof(telegraf_ip));
|
||||
MESA_load_profile_string_def(profile, section, "app_name", app_name, sizeof(app_name), "metric");
|
||||
MESA_load_profile_int_def(profile, section, "cycle", &cycle, 1000);
|
||||
|
||||
return tfe_fieldstat_metric_create(telegraf_ip, telegraf_port, app_name, cycle, max_thread, g_doh_conf->local_logger);
|
||||
}
|
||||
|
||||
int doh_on_init(struct tfe_proxy *proxy)
|
||||
{
|
||||
const char *profile = "./conf/doh/doh.conf";
|
||||
@@ -695,7 +680,6 @@ int doh_on_init(struct tfe_proxy *proxy)
|
||||
|
||||
g_doh_conf->thread_num = tfe_proxy_get_work_thread_count();
|
||||
g_doh_conf->local_logger = MESA_create_runtime_log_handle("doh", RLOG_LV_DEBUG);
|
||||
g_doh_conf->fieldstat = doh_fieldstat_init(profile, "proxy_hits", g_doh_conf->thread_num);
|
||||
|
||||
g_doh_conf->gc_evbase = tfe_proxy_get_gc_evbase();
|
||||
g_doh_conf->fs_handle = tfe_proxy_get_fs_handle();
|
||||
@@ -876,7 +860,7 @@ int doh_on_data(const struct tfe_stream *stream, const struct tfe_http_session *
|
||||
void doh_send_metric_log(const struct tfe_stream * stream, struct doh_ctx *ctx, unsigned int thread_id)
|
||||
{
|
||||
size_t c2s_byte_num = 0, s2c_byte_num =0;
|
||||
struct tfe_fieldstat_metric_t *fieldstat = g_doh_conf->fieldstat;
|
||||
struct tfe_fieldstat_metric_t *fieldstat = (struct tfe_fieldstat_metric_t *)tfe_bussiness_resouce_get(DYNAMIC_FIELDSTAT);
|
||||
|
||||
fieldstat->tags[thread_id][TAG_RULE_ID].value_int = ctx->result->config_id;
|
||||
fieldstat->tags[thread_id][TAG_ACTION].value_int = 48;
|
||||
|
||||
Reference in New Issue
Block a user