增加逐流的上、下游收发字节统计并对业务插件提供查询接口。

This commit is contained in:
luqiuwen
2019-08-13 19:50:51 +08:00
parent 1e869c3ded
commit 3015d4df86
6 changed files with 107 additions and 14 deletions

View File

@@ -16,7 +16,7 @@ struct tfe_thread_ctx
struct event_base * evbase;
struct evdns_base* dnsbase;
unsigned char running;
unsigned int nr_modules;
const struct tfe_plugin * modules;
};
@@ -48,7 +48,6 @@ struct tfe_conn_private
struct bufferevent * bev;
struct ev_token_bucket_cfg * ratelimit_bucket;
uint8_t on_writing;
size_t total_rx_bytes, total_tx_bytes;
};
enum tfe_stream_event_log_type
@@ -96,7 +95,6 @@ struct tfe_stream_private
size_t forward_bytes;
size_t drop_bytes;
size_t defer_bytes;
struct timeval defer_timeval;
@@ -140,6 +138,10 @@ struct tfe_stream_private
/* CONNECTION LOG */
char ssl_downstream_info_dump[TFE_STRING_MAX];
char ssl_upstream_info_dump[TFE_STRING_MAX];
/* OFFSET FOR LOG */
size_t downstream_rx_offset;
size_t upstream_rx_offset;
};
static inline void * __STREAM_LOGGER(struct tfe_stream_private * _stream)

View File

@@ -20,6 +20,7 @@ enum TFE_STAT_FIELD
STAT_FD_INSTANT_CLOSE,
STAT_FD_DEFER_CLOSE_IN_QUEUE,
STAT_FD_DEFER_CLOSE_SUCCESS,
/* Stream */
STAT_STREAM_OPEN,
STAT_STREAM_CLS,
@@ -32,6 +33,11 @@ enum TFE_STAT_FIELD
/* Stream Protocol */
STAT_STREAM_TCP_PLAIN,
STAT_STREAM_TCP_SSL,
/* RX DATA */
STAT_STREAM_DOWN_RX_BYTES,
STAT_STREAM_UP_RX_BYTES,
TFE_STAT_MAX
};