diff options
| author | wangmenglan <[email protected]> | 2024-02-22 15:59:32 +0800 |
|---|---|---|
| committer | wangmenglan <[email protected]> | 2024-02-22 18:05:41 +0800 |
| commit | a2dce7672acb5f21f2d4e111d3a9965de5cd1327 (patch) | |
| tree | 6aa3f2e7d1b4f57a3ec20436796084cae01930ac /common/src/tfe_fieldstat.cpp | |
| parent | 43a9b6474e369e061a856fe6297f696427b38d29 (diff) | |
TSG-19479 调整发送metrics的时机v4.8.66-20240222
Diffstat (limited to 'common/src/tfe_fieldstat.cpp')
| -rw-r--r-- | common/src/tfe_fieldstat.cpp | 17 |
1 files 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); |
