From 268b80c3de6727ba0d82af3df433091b2225142e Mon Sep 17 00:00:00 2001 From: fengweihao Date: Fri, 30 Aug 2024 11:47:22 +0800 Subject: TSG-22251 Manipulate统计中,当Metric无有效数值时,不在调用filedstat4发送Metric 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); -- cgit v1.2.3