From 268b80c3de6727ba0d82af3df433091b2225142e Mon Sep 17 00:00:00 2001 From: fengweihao Date: Fri, 30 Aug 2024 11:47:22 +0800 Subject: [PATCH] =?UTF-8?q?TSG-22251=20Manipulate=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E5=BD=93Metric=E6=97=A0=E6=9C=89=E6=95=88?= =?UTF-8?q?=E6=95=B0=E5=80=BC=E6=97=B6=EF=BC=8C=E4=B8=8D=E5=9C=A8=E8=B0=83?= =?UTF-8?q?=E7=94=A8filedstat4=E5=8F=91=E9=80=81Metric?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/tfe/tfe.conf | 2 -- plugin/business/tsg-http/src/tsg_http.cpp | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/tfe/tfe.conf b/conf/tfe/tfe.conf index e1e43a9..76e38d7 100644 --- a/conf/tfe/tfe.conf +++ b/conf/tfe/tfe.conf @@ -218,11 +218,9 @@ full_cfg_dir=pangu_policy/full/index/ inc_cfg_dir=pangu_policy/inc/index/ [proxy_hits] -cycle=0 app_name="proxy_rule_hits" output_fs_interval_ms=500 output_kafka_interval_ms=1000 -outpath="metrics/porxy_fieldstat.json" # for enable kni v4 [packet_io] diff --git a/plugin/business/tsg-http/src/tsg_http.cpp b/plugin/business/tsg-http/src/tsg_http.cpp index 2f4e263..511d53e 100644 --- a/plugin/business/tsg-http/src/tsg_http.cpp +++ b/plugin/business/tsg-http/src/tsg_http.cpp @@ -1469,6 +1469,11 @@ void proxy_send_metric_log(const struct tfe_stream * stream, struct proxy_http_c out_bytes=0; } + if(hit_cnt == 0 && in_bytes == 0 && out_bytes == 0) + { + continue; + } + tfe_fieldstat_manipulation_incrby(fieldstat, fieldstat->counter_array[COLUMN_HIT_COUNT], hit_cnt, fieldstat->tags[thread_id], TAG_MAX - 1, thread_id); tfe_fieldstat_manipulation_incrby(fieldstat, fieldstat->counter_array[COLUMN_IN_BYTES], in_bytes, fieldstat->tags[thread_id], TAG_MAX - 1, thread_id); tfe_fieldstat_manipulation_incrby(fieldstat, fieldstat->counter_array[COLUMN_OUT_BYTES], out_bytes, fieldstat->tags[thread_id], TAG_MAX - 1, thread_id);