TSG-19479 调整发送metrics的时机

This commit is contained in:
wangmenglan
2024-02-22 15:59:32 +08:00
parent 43a9b6474e
commit a2dce7672a

View File

@@ -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, &current_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);