packet IO stat metric rename

This commit is contained in:
luwenpeng
2024-08-16 17:44:23 +08:00
parent 169607cd1e
commit 2b9e867071
5 changed files with 95 additions and 129 deletions

View File

@@ -15,24 +15,24 @@
#define IS_BUSY 0xf
typedef uint64_t get_val_func(struct thread_stat *thr_stat);
static inline uint64_t get_dev_rx_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->dev_rx_pkts; }
static inline uint64_t get_dev_rx_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->dev_rx_bytes; }
static inline uint64_t get_dev_tx_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->dev_tx_pkts; }
static inline uint64_t get_dev_tx_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->dev_tx_bytes; }
static inline uint64_t get_pkts_rx(struct thread_stat *thr_stat) { return thr_stat->packet_io->pkts_rx; }
static inline uint64_t get_bytes_rx(struct thread_stat *thr_stat) { return thr_stat->packet_io->bytes_rx; }
static inline uint64_t get_pkts_tx(struct thread_stat *thr_stat) { return thr_stat->packet_io->pkts_tx; }
static inline uint64_t get_bytes_tx(struct thread_stat *thr_stat) { return thr_stat->packet_io->bytes_tx; }
static inline uint64_t get_keep_alive_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->keep_alive_pkts; }
static inline uint64_t get_keep_alive_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->keep_alive_bytes; }
static inline uint64_t get_raw_rx_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->raw_rx_pkts; }
static inline uint64_t get_raw_rx_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->raw_rx_bytes; }
static inline uint64_t get_raw_tx_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->raw_tx_pkts; }
static inline uint64_t get_raw_tx_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->raw_tx_bytes; }
static inline uint64_t get_drop_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->drop_pkts; }
static inline uint64_t get_drop_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->drop_bytes; }
static inline uint64_t get_inject_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->inject_pkts; }
static inline uint64_t get_inject_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->inject_bytes; }
static inline uint64_t get_ctrl_rx_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->ctrl_rx_pkts; }
static inline uint64_t get_ctrl_rx_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->ctrl_rx_bytes; }
static inline uint64_t get_ctrl_tx_pkts(struct thread_stat *thr_stat) { return thr_stat->packet_io->ctrl_tx_pkts; }
static inline uint64_t get_ctrl_tx_bytes(struct thread_stat *thr_stat) { return thr_stat->packet_io->ctrl_tx_bytes; }
static inline uint64_t get_raw_pkts_rx(struct thread_stat *thr_stat) { return thr_stat->packet_io->raw_pkts_rx; }
static inline uint64_t get_raw_bytes_rx(struct thread_stat *thr_stat) { return thr_stat->packet_io->raw_bytes_rx; }
static inline uint64_t get_raw_pkts_tx(struct thread_stat *thr_stat) { return thr_stat->packet_io->raw_pkts_tx; }
static inline uint64_t get_raw_bytes_tx(struct thread_stat *thr_stat) { return thr_stat->packet_io->raw_bytes_tx; }
static inline uint64_t get_pkts_dropped(struct thread_stat *thr_stat) { return thr_stat->packet_io->pkts_dropped; }
static inline uint64_t get_bytes_dropped(struct thread_stat *thr_stat) { return thr_stat->packet_io->bytes_dropped; }
static inline uint64_t get_pkts_injected(struct thread_stat *thr_stat) { return thr_stat->packet_io->pkts_injected; }
static inline uint64_t get_bytes_injected(struct thread_stat *thr_stat) { return thr_stat->packet_io->bytes_injected; }
static inline uint64_t get_ctrl_pkts_rx(struct thread_stat *thr_stat) { return thr_stat->packet_io->ctrl_pkts_rx; }
static inline uint64_t get_ctrl_bytes_rx(struct thread_stat *thr_stat) { return thr_stat->packet_io->ctrl_bytes_rx; }
static inline uint64_t get_ctrl_pkts_tx(struct thread_stat *thr_stat) { return thr_stat->packet_io->ctrl_pkts_tx; }
static inline uint64_t get_ctrl_bytes_tx(struct thread_stat *thr_stat) { return thr_stat->packet_io->ctrl_bytes_tx; }
static inline uint64_t get_ip4_flow_find(struct thread_stat *thr_stat) { return thr_stat->ip_reassembly->ip4_flow_find; }
static inline uint64_t get_ip4_flow_add(struct thread_stat *thr_stat) { return thr_stat->ip_reassembly->ip4_flow_add; }
static inline uint64_t get_ip4_flow_del(struct thread_stat *thr_stat) { return thr_stat->ip_reassembly->ip4_flow_del; }
@@ -85,6 +85,12 @@ static inline uint64_t get_tcp_seg_reorded(struct thread_stat *thr_stat) { retur
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,29 +98,29 @@ 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},
{"pkts_rx", get_pkts_rx},
{"bytes_rx", get_bytes_rx},
{"pkts_tx", get_pkts_tx},
{"bytes_tx", get_bytes_tx},
// keep-alive packet
{"keep_alive_pkts", get_keep_alive_pkts},
{"keep_alive_bytes", get_keep_alive_bytes},
// raw packet
{"raw_rx_pkts", get_raw_rx_pkts},
{"raw_rx_bytes", get_raw_rx_bytes},
{"raw_tx_pkts", get_raw_tx_pkts},
{"raw_tx_bytes", get_raw_tx_bytes},
{"raw_pkts_rx", get_raw_pkts_rx},
{"raw_bytes_rx", get_raw_bytes_rx},
{"raw_pkts_tx", get_raw_pkts_tx},
{"raw_bytes_tx", get_raw_bytes_tx},
// drop packet
{"drop_pkts", get_drop_pkts},
{"drop_bytes", get_drop_bytes},
{"pkts_dropped", get_pkts_dropped},
{"bytes_dropped", get_bytes_dropped},
// inject packet
{"inject_pkts", get_inject_pkts},
{"inject_bytes", get_inject_bytes},
{"pkts_injected", get_pkts_injected},
{"bytes_injected", get_bytes_injected},
// ctrl packet
{"ctrl_rx_pkts", get_ctrl_rx_pkts},
{"ctrl_rx_bytes", get_ctrl_rx_bytes},
{"ctrl_tx_pkts", get_ctrl_tx_pkts},
{"ctrl_tx_bytes", get_ctrl_tx_bytes},
{"ctrl_pkts_rx", get_ctrl_pkts_rx},
{"ctrl_bytes_rx", get_ctrl_bytes_rx},
{"ctrl_pkts_tx", get_ctrl_pkts_tx},
{"ctrl_bytes_tx", get_ctrl_bytes_tx},
// ipv4 reassembly
{"ip4_flow_find", get_ip4_flow_find},
{"ip4_flow_add", get_ip4_flow_add},