TCP reassembly stat metric rename

This commit is contained in:
luwenpeng
2024-08-16 18:24:54 +08:00
parent 2b9e867071
commit 522c4bb6d7
4 changed files with 44 additions and 44 deletions

View File

@@ -75,15 +75,15 @@ static inline uint64_t get_tcp_pkts_nosess_bypass(struct thread_stat *thr_stat)
static inline uint64_t get_tcp_pkts_duped_bypass(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_pkts_duped_bypass; }
static inline uint64_t get_udp_pkts_duped_bypass(struct thread_stat *thr_stat) { return thr_stat->session_mgr->udp_pkts_duped_bypass; }
static inline uint64_t get_udp_pkts_evctd_bypass(struct thread_stat *thr_stat) { return thr_stat->session_mgr->udp_pkts_evctd_bypass; }
static inline uint64_t get_tcp_seg_received(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_received; }
static inline uint64_t get_tcp_seg_expired(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_expired; }
static inline uint64_t get_tcp_seg_retransmit(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_retransmit; }
static inline uint64_t get_tcp_seg_overlap(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_overlap; }
static inline uint64_t get_tcp_seg_no_space(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_no_space; }
static inline uint64_t get_tcp_seg_inorder(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_inorder; }
static inline uint64_t get_tcp_seg_reorded(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_reorded; }
static inline uint64_t get_tcp_seg_buffered(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_buffered; }
static inline uint64_t get_tcp_seg_released(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_seg_released; }
static inline uint64_t get_tcp_segs_input(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_input; }
static inline uint64_t get_tcp_segs_timeout(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_timeout; }
static inline uint64_t get_tcp_segs_retransmited(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_retransmited; }
static inline uint64_t get_tcp_segs_overlapped(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_overlapped; }
static inline uint64_t get_tcp_segs_omitted_too_many(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_omitted_too_many; }
static inline uint64_t get_tcp_segs_inorder(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_inorder; }
static inline uint64_t get_tcp_segs_reordered(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_reordered; }
static inline uint64_t get_tcp_segs_buffered(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_buffered; }
static inline uint64_t get_tcp_segs_freed(struct thread_stat *thr_stat) { return thr_stat->session_mgr->tcp_segs_freed; }
/*
* This naming convention maintains consistency by using a clear, structured pattern:
@@ -170,15 +170,15 @@ struct metric_schema
{"udp_pkts_duped_bypass", get_udp_pkts_duped_bypass},
{"udp_pkts_evctd_bypass", get_udp_pkts_evctd_bypass},
// TCP segments
{"tcp_seg_received", get_tcp_seg_received},
{"tcp_seg_expired", get_tcp_seg_expired},
{"tcp_seg_retransmit", get_tcp_seg_retransmit},
{"tcp_seg_overlap", get_tcp_seg_overlap},
{"tcp_seg_no_space", get_tcp_seg_no_space},
{"tcp_seg_inorder", get_tcp_seg_inorder},
{"tcp_seg_reorded", get_tcp_seg_reorded},
{"tcp_seg_buffered", get_tcp_seg_buffered},
{"tcp_seg_released", get_tcp_seg_released},
{"tcp_segs_input", get_tcp_segs_input},
{"tcp_segs_timeout", get_tcp_segs_timeout},
{"tcp_segs_retransmited", get_tcp_segs_retransmited},
{"tcp_segs_overlapped", get_tcp_segs_overlapped},
{"tcp_segs_omitted_too_many", get_tcp_segs_omitted_too_many},
{"tcp_segs_inorder", get_tcp_segs_inorder},
{"tcp_segs_reordered", get_tcp_segs_reordered},
{"tcp_segs_buffered", get_tcp_segs_buffered},
{"tcp_segs_freed", get_tcp_segs_freed},
};
struct stellar_stat

View File

@@ -247,7 +247,7 @@ static void tcp_clean(struct session_manager *mgr, struct session *sess)
{
session_inc_stat(sess, FLOW_DIRECTION_C2S, STAT_TCP_SEGMENTS_RELEASED, 1);
session_inc_stat(sess, FLOW_DIRECTION_C2S, STAT_TCP_PAYLOADS_RELEASED, seg->len);
mgr->stat.tcp_seg_released++;
mgr->stat.tcp_segs_freed++;
tcp_segment_free(seg);
}
tcp_reassembly_free(c2s_ssembler);
@@ -258,7 +258,7 @@ static void tcp_clean(struct session_manager *mgr, struct session *sess)
{
session_inc_stat(sess, FLOW_DIRECTION_S2C, STAT_TCP_SEGMENTS_RELEASED, 1);
session_inc_stat(sess, FLOW_DIRECTION_S2C, STAT_TCP_PAYLOADS_RELEASED, seg->len);
mgr->stat.tcp_seg_released++;
mgr->stat.tcp_segs_freed++;
tcp_segment_free(seg);
}
tcp_reassembly_free(s2c_ssembler);
@@ -312,11 +312,11 @@ static void tcp_update(struct session_manager *mgr, struct session *sess, enum f
{
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_RECEIVED, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_RECEIVED, len);
mgr->stat.tcp_seg_received++;
mgr->stat.tcp_segs_input++;
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_INORDER, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_INORDER, len);
mgr->stat.tcp_seg_inorder++;
mgr->stat.tcp_segs_inorder++;
half->in_order.data = tcp_layer->pld_ptr;
half->in_order.len = len;
@@ -336,11 +336,11 @@ static void tcp_update(struct session_manager *mgr, struct session *sess, enum f
{
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_EXPIRED, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_EXPIRED, seg->len);
mgr->stat.tcp_seg_expired++;
mgr->stat.tcp_segs_timeout++;
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_RELEASED, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_RELEASED, seg->len);
mgr->stat.tcp_seg_released++;
mgr->stat.tcp_segs_freed++;
tcp_segment_free(seg);
}
@@ -349,7 +349,7 @@ static void tcp_update(struct session_manager *mgr, struct session *sess, enum f
{
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_RECEIVED, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_RECEIVED, len);
mgr->stat.tcp_seg_received++;
mgr->stat.tcp_segs_input++;
uint32_t rcv_nxt = tcp_reassembly_get_recv_next(half->assembler);
// in order
@@ -357,7 +357,7 @@ static void tcp_update(struct session_manager *mgr, struct session *sess, enum f
{
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_INORDER, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_INORDER, len);
mgr->stat.tcp_seg_inorder++;
mgr->stat.tcp_segs_inorder++;
half->in_order.data = tcp_layer->pld_ptr;
half->in_order.len = len;
@@ -369,7 +369,7 @@ static void tcp_update(struct session_manager *mgr, struct session *sess, enum f
{
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_RETRANSMIT, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_RETRANSMIT, len);
mgr->stat.tcp_seg_retransmit++;
mgr->stat.tcp_segs_retransmited++;
}
else if ((seg = tcp_segment_new(half->seq, tcp_layer->pld_ptr, len)))
{
@@ -378,28 +378,28 @@ static void tcp_update(struct session_manager *mgr, struct session *sess, enum f
case -2:
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_RETRANSMIT, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_RETRANSMIT, len);
mgr->stat.tcp_seg_retransmit++;
mgr->stat.tcp_segs_retransmited++;
tcp_segment_free(seg);
break;
case -1:
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_NOSPACE, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_NOSPACE, len);
mgr->stat.tcp_seg_no_space++;
mgr->stat.tcp_segs_omitted_too_many++;
tcp_segment_free(seg);
break;
case 0:
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_BUFFERED, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_BUFFERED, len);
mgr->stat.tcp_seg_buffered++;
mgr->stat.tcp_segs_buffered++;
break;
case 1:
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_OVERLAP, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_OVERLAP, len);
mgr->stat.tcp_seg_overlap++;
mgr->stat.tcp_segs_overlapped++;
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_BUFFERED, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_BUFFERED, len);
mgr->stat.tcp_seg_buffered++;
mgr->stat.tcp_segs_buffered++;
break;
default:
assert(0);
@@ -410,7 +410,7 @@ static void tcp_update(struct session_manager *mgr, struct session *sess, enum f
{
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_NOSPACE, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_NOSPACE, len);
mgr->stat.tcp_seg_no_space++;
mgr->stat.tcp_segs_omitted_too_many++;
}
}
}

View File

@@ -78,15 +78,15 @@ struct session_manager_stat
uint64_t udp_pkts_evctd_bypass; // sum
// TCP segments
uint64_t tcp_seg_received; // sum
uint64_t tcp_seg_expired; // sum
uint64_t tcp_seg_retransmit; // sum
uint64_t tcp_seg_overlap; // sum
uint64_t tcp_seg_no_space; // sum
uint64_t tcp_seg_inorder; // sum
uint64_t tcp_seg_reorded; // sum
uint64_t tcp_seg_buffered; // sum
uint64_t tcp_seg_released; // sum
uint64_t tcp_segs_input; // sum
uint64_t tcp_segs_timeout; // sum
uint64_t tcp_segs_retransmited; // sum
uint64_t tcp_segs_overlapped; // sum
uint64_t tcp_segs_omitted_too_many; // sum
uint64_t tcp_segs_inorder; // sum
uint64_t tcp_segs_reordered; // sum
uint64_t tcp_segs_buffered; // sum
uint64_t tcp_segs_freed; // sum
};
struct session_manager;

View File

@@ -252,7 +252,7 @@ struct tcp_segment *session_get_tcp_segment(struct session *sess)
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_REORDERED, seg->len);
// TODO
sess->mgr_stat->tcp_seg_reorded++;
sess->mgr_stat->tcp_segs_reordered++;
}
return seg;
}
@@ -278,7 +278,7 @@ void session_free_tcp_segment(struct session *sess, struct tcp_segment *seg)
{
session_inc_stat(sess, dir, STAT_TCP_SEGMENTS_RELEASED, 1);
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_RELEASED, seg->len);
sess->mgr_stat->tcp_seg_released++;
sess->mgr_stat->tcp_segs_freed++;
tcp_segment_free(seg);
}