diff options
| author | yangwei <[email protected]> | 2024-08-15 18:48:58 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-08-16 10:48:40 +0800 |
| commit | 08208cf0a5e90caf1dc649ef42bd4b259931f574 (patch) | |
| tree | 2510125d7ae52a5ab38de93e6be2181ecf2b463e | |
| parent | 335c6f867bb2d0b377b7fddb0dac5ca1bb2bcd8a (diff) | |
🦄 refactor(stellar_stat): rename metrics name
| -rw-r--r-- | src/core/stellar_stat.cpp | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/src/core/stellar_stat.cpp b/src/core/stellar_stat.cpp index 63a88a3..a0959b2 100644 --- a/src/core/stellar_stat.cpp +++ b/src/core/stellar_stat.cpp @@ -84,7 +84,13 @@ static inline uint64_t get_tcp_seg_inorder(struct thread_stat *thr_stat) { retur 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; } +/* +This naming convention maintains consistency by using a clear, structured pattern: + • tcp_sessions_ or ipv6_frags_ as the prefix to indicate the type of data. + • Action or status (e.g., bypassed, active, dropped) as the middle part. + • Cause or condition (e.g., full_table, buffer_limit) as the suffix for additional clarity. + */ struct metric_schema { const char *name; @@ -92,10 +98,10 @@ struct metric_schema } schemas[] = { // device packet - {"dev_rx_pkts", get_dev_rx_pkts}, - {"dev_rx_bytes", get_dev_rx_bytes}, - {"dev_tx_pkts", get_dev_tx_pkts}, - {"dev_tx_bytes", get_dev_tx_bytes}, + {"rx_pkts", get_dev_rx_pkts}, + {"rx_bytes", get_dev_rx_bytes}, + {"tx_pkts", get_dev_tx_pkts}, + {"tx_bytes", get_dev_tx_bytes}, // keep-alive packet {"keep_alive_pkts", get_keep_alive_pkts}, {"keep_alive_bytes", get_keep_alive_bytes}, @@ -105,14 +111,14 @@ struct metric_schema {"raw_tx_pkts", get_raw_tx_pkts}, {"raw_tx_bytes", get_raw_tx_bytes}, // drop packet - {"drop_pkts", get_drop_pkts}, - {"drop_bytes", get_drop_bytes}, + {"pkts_dropped", get_drop_pkts}, + {"bytes_dropped", get_drop_bytes}, // inject packet - {"inject_pkts", get_inject_pkts}, - {"inject_bytes", get_inject_bytes}, + {"pkts_injected", get_inject_pkts}, + {"bytes_injected", get_inject_bytes}, // ctrl packet - {"ctrl_rx_pkts", get_ctrl_rx_pkts}, - {"ctrl_rx_bytes", get_ctrl_rx_bytes}, + {"ctrl_pkts_rx", get_ctrl_rx_pkts}, + {"ctrl_bytes_rx", get_ctrl_rx_bytes}, {"ctrl_tx_pkts", get_ctrl_tx_pkts}, {"ctrl_tx_bytes", get_ctrl_tx_bytes}, // ipv4 reassembly @@ -127,20 +133,20 @@ struct metric_schema {"ip4_flow_bypass_dup_fist_frag", get_ip4_flow_bypass_dup_fist_frag}, {"ip4_flow_bypass_dup_last_frag", get_ip4_flow_bypass_dup_last_frag}, // ipv6 reassembly - {"ip6_flow_find", get_ip6_flow_find}, - {"ip6_flow_add", get_ip6_flow_add}, - {"ip6_flow_del", get_ip6_flow_del}, - {"ip6_flow_timeout", get_ip6_flow_timeout}, - {"ip6_flow_fail_no_space", get_ip6_flow_fail_no_space}, - {"ip6_flow_fail_overlap", get_ip6_flow_fail_overlap}, - {"ip6_flow_fail_many_frag", get_ip6_flow_fail_many_frag}, + {"ip6_frags", get_ip6_flow_find}, + {"ip6_frags_buffered", get_ip6_flow_add}, + {"ip6_frags_freed", get_ip6_flow_del}, + {"ip6_frags_timeout", get_ip6_flow_timeout}, + {"ip6_frags_bypass_no_buffer", get_ip6_flow_fail_no_space}, + {"ip6_frags_bypass_overlap", get_ip6_flow_fail_overlap}, + {"ip6_frags_bypass_too_many", get_ip6_flow_fail_many_frag}, {"ip6_flow_fail_invalid_length", get_ip6_flow_fail_invalid_length}, {"ip6_flow_bypass_dup_fist_frag", get_ip6_flow_bypass_dup_fist_frag}, {"ip6_flow_bypass_dup_last_frag", get_ip6_flow_bypass_dup_last_frag}, // TCP session {"total_tcp_sess_used", get_total_tcp_sess_used}, {"curr_tcp_sess_used", get_curr_tcp_sess_used}, - {"curr_tcp_sess_opening", get_curr_tcp_sess_opening}, + {"tcp_sess_opening", get_curr_tcp_sess_opening}, {"curr_tcp_sess_active", get_curr_tcp_sess_active}, {"curr_tcp_sess_closing", get_curr_tcp_sess_closing}, {"curr_tcp_sess_discard", get_curr_tcp_sess_discard}, @@ -157,22 +163,22 @@ struct metric_schema {"tcp_sess_evicted", get_tcp_sess_evicted}, {"udp_sess_evicted", get_udp_sess_evicted}, // Packet - {"udp_pkts_nospace_bypass", get_udp_pkts_nospace_bypass}, - {"tcp_pkts_nospace_bypass", get_tcp_pkts_nospace_bypass}, - {"tcp_pkts_nosess_bypass", get_tcp_pkts_nosess_bypass}, - {"tcp_pkts_duped_bypass", get_tcp_pkts_duped_bypass}, - {"udp_pkts_duped_bypass", get_udp_pkts_duped_bypass}, - {"udp_pkts_evctd_bypass", get_udp_pkts_evctd_bypass}, + {"udp_pkts_bypass_table_full", get_udp_pkts_nospace_bypass}, + {"tcp_pkts_bypass_table_full", get_tcp_pkts_nospace_bypass}, + {"tcp_pkts_bypass_session_not_found", get_tcp_pkts_nosess_bypass}, + {"tcp_pkts_bypass_duplicated", get_tcp_pkts_duped_bypass}, + {"udp_pkts_bypass_duplicated", get_udp_pkts_duped_bypass}, + {"udp_pkts_bypass_session_evicted", 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_seg_received}, + {"tcp_segs_timeout", get_tcp_seg_expired}, + {"tcp_segs_retransmited", get_tcp_seg_retransmit}, + {"tcp_segs_overlapped", get_tcp_seg_overlap}, + {"tcp_segs_omitted_too_many", get_tcp_seg_no_space}, + {"tcp_segs_inorder", get_tcp_seg_inorder}, + {"tcp_segs_reordered", get_tcp_seg_reorded}, + {"tcp_segs_buffered", get_tcp_seg_buffered}, + {"tcp_segs_freed", get_tcp_seg_released}, }; struct stellar_stat |
