From b497224a3738a8c55768915288eafdeb97573d66 Mon Sep 17 00:00:00 2001 From: yangwei Date: Thu, 9 May 2024 15:15:48 +0800 Subject: 🐞 fix(dp trace): 仅在异常时记录诊断信息 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dealpkt/plug_support.c | 9 --------- src/packet_io/packet_io_marsio.c | 23 ++++++++++++----------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/dealpkt/plug_support.c b/src/dealpkt/plug_support.c index ee343c0..50868f0 100644 --- a/src/dealpkt/plug_support.c +++ b/src/dealpkt/plug_support.c @@ -1127,9 +1127,6 @@ int MESA_set_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt o memset(pstream_pr->sid_append_list, 0, sizeof(struct segment_id_list)); } } - char tmp_buff[256]; - snprintf(tmp_buff, sizeof(tmp_buff), "update sid_append_list_sz=%u", set_sid_list->sz_sidlist); - marsio4_emit_datapath_telemetry(pstream_pr->raw_pkt, "sapp", tmp_buff); ret = 0; } break; @@ -1163,9 +1160,6 @@ int MESA_set_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt o memset(pstream_pr->sid_prepend_list, 0, sizeof(struct segment_id_list)); } } - char tmp_buff[256]; - snprintf(tmp_buff, sizeof(tmp_buff), "update sid_prepend_list_sz=%u", set_sid_list->sz_sidlist); - marsio4_emit_datapath_telemetry(pstream_pr->raw_pkt, "sapp", tmp_buff); ret = 0; } break; @@ -1178,9 +1172,6 @@ int MESA_set_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt o break; } pstream_pr->stream_trace_id=*((unsigned long long *)opt_val); - char tmp_buff[256]; - snprintf(tmp_buff, sizeof(tmp_buff), "update trace_id=%llu", pstream_pr->stream_trace_id); - marsio4_emit_datapath_telemetry(pstream_pr->raw_pkt, "sapp", tmp_buff); ret=0; } break; diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c index 479b0d1..fe1242b 100644 --- a/src/packet_io/packet_io_marsio.c +++ b/src/packet_io/packet_io_marsio.c @@ -402,18 +402,19 @@ int marsio_dl_io_raw_pkt_send(void *phandle, unsigned char *data,int datalen, vo ptr_marsio_dp_trace_filter_exec(sapp_marsio4_instance, send_mbuf[0]); } - if(raw_pkt->is_ctrl_pkt==1) - { - marsio4_emit_datapath_telemetry(raw_pkt, "sapp", "inject=ctrl_pkt"); - } - else - { - marsio4_emit_datapath_telemetry(raw_pkt, "sapp", "inject=rawpkt"); - } - ret = ptr_marsio_send_burst_with_options((struct mr_sendpath *)arg, thread_seq, send_mbuf, 1, send_option); - if(ret < 0){ - return -1; + if(ret < 0) + { + if (raw_pkt->is_ctrl_pkt == 1) + { + marsio4_emit_datapath_telemetry(raw_pkt, "sapp", "inject_error=ctrl_pkt"); + } + else + { + marsio4_emit_datapath_telemetry(raw_pkt, "sapp", "inject_error=rawpkt"); + } + ptr_marsio_buff_free(sapp_marsio4_instance, send_mbuf, 1, MARSIO_SOCKET_ID_ANY, thread_seq); + return -1; } return datalen; } -- cgit v1.2.3