TFE Packet IO 创建metric句柄
This commit is contained in:
@@ -38,7 +38,7 @@ struct tfe_fieldstat_metric_t
|
||||
struct fieldstat_dynamic_instance *instance;
|
||||
};
|
||||
|
||||
void tfe_set_intercept_metric(struct tfe_cmsg *cmsg, int hit_count, int downstream_rx_pkts, int downstream_rx_bytes, int upstream_rx_pkts, int upstream_rx_bytes, int thread_id);
|
||||
void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct tfe_cmsg *cmsg, int hit_count, int downstream_rx_pkts, int downstream_rx_bytes, int upstream_rx_pkts, int upstream_rx_bytes, int thread_id);
|
||||
int tfe_fieldstat_metric_incrby(struct tfe_fieldstat_metric_t *fieldstat, unsigned int column_id, long long value, const struct fieldstat_tag tags[], int n_tags, int thread_id);
|
||||
struct tfe_fieldstat_metric_t *tfe_fieldstat_metric_create(char *telegraf_ip, int telegraf_port, char *app_name, int cycle, int max_thread, void *local_logger);
|
||||
void tfe_fieldstat_metric_destroy(struct tfe_fieldstat_metric_t *fieldstat);
|
||||
|
||||
@@ -89,6 +89,7 @@ struct acceptor_kni_v4
|
||||
|
||||
struct packet_io *io;
|
||||
struct packet_io_fs *packet_io_fs;
|
||||
struct tfe_fieldstat_metric_t *metric;
|
||||
struct packet_io_thread_ctx work_threads[TFE_THREAD_MAX];
|
||||
|
||||
struct tfe_proxy *ref_proxy;
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
#include "tfe_stream.h"
|
||||
#include "tfe_resource.h"
|
||||
|
||||
void tfe_set_intercept_metric(struct tfe_cmsg *cmsg, int hit_count, int downstream_rx_pkts, int downstream_rx_bytes, int upstream_rx_pkts, int upstream_rx_bytes, int thread_id)
|
||||
void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct tfe_cmsg *cmsg, int hit_count, int downstream_rx_pkts, int downstream_rx_bytes, int upstream_rx_pkts, int upstream_rx_bytes, int thread_id)
|
||||
{
|
||||
int ret;
|
||||
uint16_t out_size;
|
||||
struct tfe_fieldstat_metric_t *fieldstat = (struct tfe_fieldstat_metric_t *)tfe_bussiness_resouce_get(DYNAMIC_FIELDSTAT);
|
||||
|
||||
if (cmsg == NULL)
|
||||
{
|
||||
|
||||
@@ -1416,6 +1416,7 @@ static int handle_session_closing(struct metadata *meta, struct ctrl_pkt_parser
|
||||
{
|
||||
struct packet_io_thread_ctx *thread = (struct packet_io_thread_ctx *)ctx;
|
||||
struct packet_io_fs *packet_io_fs = thread->ret_fs_state;
|
||||
struct acceptor_kni_v4 *acceptor_ctx = thread->ref_acceptor_ctx;
|
||||
void * logger = thread->logger;
|
||||
|
||||
struct session_node *node = session_table_search_by_id(thread->session_table, meta->session_id);
|
||||
@@ -1423,7 +1424,7 @@ static int handle_session_closing(struct metadata *meta, struct ctrl_pkt_parser
|
||||
{
|
||||
struct session_ctx *s_ctx = (struct session_ctx *)node->val_data;
|
||||
TFE_LOG_INFO(logger, "%s: session %lu closing", LOG_TAG_PKTIO, s_ctx->session_id);
|
||||
tfe_set_intercept_metric(s_ctx->cmsg, 1, s_ctx->c2s_info.rx.n_pkts, s_ctx->c2s_info.rx.n_bytes, s_ctx->s2c_info.rx.n_pkts, s_ctx->s2c_info.rx.n_bytes, thread_seq);
|
||||
tfe_set_intercept_metric(acceptor_ctx->metric, s_ctx->cmsg, 1, s_ctx->c2s_info.rx.n_pkts, s_ctx->c2s_info.rx.n_bytes, s_ctx->s2c_info.rx.n_pkts, s_ctx->s2c_info.rx.n_bytes, thread_seq);
|
||||
session_table_delete_by_id(thread->session_table, meta->session_id);
|
||||
ATOMIC_DEC(&(packet_io_fs->session_num));
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user