From a2dce7672acb5f21f2d4e111d3a9965de5cd1327 Mon Sep 17 00:00:00 2001 From: wangmenglan Date: Thu, 22 Feb 2024 15:59:32 +0800 Subject: [PATCH] =?UTF-8?q?TSG-19479=20=E8=B0=83=E6=95=B4=E5=8F=91?= =?UTF-8?q?=E9=80=81metrics=E7=9A=84=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/tfe_fieldstat.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/common/src/tfe_fieldstat.cpp b/common/src/tfe_fieldstat.cpp index 04523af..7527a13 100644 --- a/common/src/tfe_fieldstat.cpp +++ b/common/src/tfe_fieldstat.cpp @@ -8,6 +8,7 @@ void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct session_ctx *s_ctx, int thread_id, int is_session_close) { int ret; + int hit_count = 0; uint16_t out_size; struct tfe_cmsg *cmsg = s_ctx->cmsg; struct timespec current_time; @@ -17,6 +18,16 @@ void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct s return; } + if (s_ctx->metric_hit == 0) { + int flag = 0; + flag = tfe_cmsg_get_flag(cmsg); + if ((flag & TFE_CMSG_FLAG_USER0) == 0) { + return; + } + s_ctx->metric_hit = 1; + hit_count = 1; + } + if (!is_session_close) { clock_gettime(CLOCK_MONOTONIC, ¤t_time); @@ -35,12 +46,6 @@ void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct s int upstream_rx_bytes = s_ctx->s2c_info.rx.n_bytes - s_ctx->s2c_info.rx_send_complete.n_bytes; s_ctx->c2s_info.rx_send_complete = s_ctx->c2s_info.rx; s_ctx->s2c_info.rx_send_complete = s_ctx->s2c_info.rx; - int hit_count = 0; - - if (s_ctx->metric_hit == 0) { - s_ctx->metric_hit = 1; - hit_count = 1; - } int vsys_id = 0; ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_POLICY_VSYS_ID, (unsigned char *)&vsys_id, sizeof(vsys_id), &out_size);