TSG-2482 dashboard统计策略命中数问题

(适配配置表结构修改,下个版本修复表名过长问题)
This commit is contained in:
fengweihao
2020-07-10 16:48:29 +08:00
parent 7bdd06fe0a
commit 39bff0023c

View File

@@ -80,7 +80,6 @@ enum pangu_http_stat
STAT_ACTION_MONIT,
STAT_ACTION_REJECT,
STAT_ACTION_REDIRECT,
STAT_ACTION_PRE_REPLACE,
STAT_ACTION_REPLACE,
STAT_ACTION_HIJACK,
STAT_ACTION_HIJACK_SZ,
@@ -201,16 +200,15 @@ static void pangu_http_stat_init(struct pangu_rt * pangu_runtime)
const char* spec[__PG_STAT_MAX]={0};
spec[STAT_SESSION]="http_sess";
spec[STAT_LOG_NUM]="log_num";
spec[STAT_ACTION_MONIT]="monitor";
spec[STAT_ACTION_REJECT]="reject";
spec[STAT_ACTION_REDIRECT]="redirect";
spec[STAT_ACTION_PRE_REPLACE]="pre_replace";
spec[STAT_ACTION_REPLACE]="replace";
spec[STAT_ACTION_HIJACK]="hijack";
spec[STAT_ACTION_HIJACK_SZ]="hijack_sz";
spec[STAT_ACTION_INSERT]="insert";
spec[STAT_ACTION_INSERT_SZ]="insert_sz";
spec[STAT_ACTION_WHITELSIT]="whitelist";
spec[STAT_ACTION_MONIT]="intercept_monitor_conn_num";
spec[STAT_ACTION_REJECT]="intercept_deny_conn_num";
spec[STAT_ACTION_REDIRECT]="intercept_redirect_conn_num";
spec[STAT_ACTION_REPLACE]="intercept_replace_conn_num";
spec[STAT_ACTION_HIJACK]="intercept_hijack_conn_num";
spec[STAT_ACTION_HIJACK_SZ]="hijack_bytes";
spec[STAT_ACTION_INSERT]="intercept_insert_conn_num";
spec[STAT_ACTION_INSERT_SZ]="insert_bytes";
spec[STAT_ACTION_WHITELSIT]="intercept_allow_conn_num";
spec[STAT_SUSPENDING]="suspending";
for(i=0;i<__PG_STAT_MAX;i++)
@@ -1839,6 +1837,7 @@ static void http_redirect(const struct tfe_http_session * session, enum tfe_http
{
assert(0);
}
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_REDIRECT]));
response = tfe_http_session_response_create(to_write, resp_code);
tfe_http_std_field_write(response, TFE_HTTP_LOCATION, rd_url);
@@ -1970,6 +1969,8 @@ static void http_hijack(const struct tfe_http_session * session, enum tfe_http_e
tfe_http_nonstd_field_write(response, "Content-Disposition", hijack_file_name);
FREE(&hijack_file_name);
}
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_HIJACK]));
const char* cont_disposition_val=tfe_http_std_field_read(to_write_sess->resp, TFE_HTTP_CONT_DISPOSITION);
if (cont_disposition_val != NULL)
{
@@ -2131,6 +2132,7 @@ static void http_insert(const struct tfe_stream * stream, const struct tfe_http_
if (rewrite_sz >0)
{
tfe_http_half_append_body(ins_ctx->replacing, rewrite_buff, rewrite_sz, 0);
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_INSERT]));
ins_ctx->actually_replaced=1;
}
else
@@ -2175,7 +2177,6 @@ static void http_manipulate(const struct tfe_stream * stream, const struct tfe_h
{
case MA_ACTION_REDIRECT:
http_redirect(session, events, ctx);
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_REDIRECT]));
break;
case MA_ACTION_BLOCK:
http_block(session, events, ctx);
@@ -2183,15 +2184,12 @@ static void http_manipulate(const struct tfe_stream * stream, const struct tfe_h
break;
case MA_ACTION_REPLACE:
http_replace(stream, session, events, body_frag, frag_size, ctx);
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_PRE_REPLACE]));
break;
case MA_ACTION_HIJACK:
http_hijack(session, events, ctx);
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_HIJACK]));
break;
case MA_ACTION_INSERT:
http_insert(stream, session, events, body_frag, frag_size, ctx);
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_INSERT]));
break;
default: assert(0);
break;