TSG-21855 使用fieldstat4序列化Intercept Policy的metric并输出到kafka
This commit is contained in:
23
common/include/metrics.h
Normal file
23
common/include/metrics.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _METRICS_H
|
||||
#define _METRICS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "kafka.h"
|
||||
#include "tfe_packet_io.h"
|
||||
|
||||
struct metrics *metrics_create(const char *profile, struct kafka *kfk);
|
||||
void metrics_destory(struct metrics *handle);
|
||||
|
||||
void metrics_single_session_output(struct session_node *node, void *ctx);
|
||||
void metrics_all_session_output(struct packet_io_thread_ctx *thread_ctx);
|
||||
int metrics_get_interval(struct metrics *handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -39,7 +39,6 @@ struct tfe_fieldstat_easy_t
|
||||
};
|
||||
|
||||
struct tfe_fieldstat_easy_t *tfe_fieldstat_easy_create(char *app_name, char *outpath, int cycle, int max_thread, void *local_logger);
|
||||
void tfe_set_intercept_metric(struct tfe_fieldstat_easy_t *fieldstat, struct session_ctx *s_ctx, int thread_id, int is_session_close);
|
||||
void tfe_fieldstat_easy_destroy(struct tfe_fieldstat_easy_t *fieldstat);
|
||||
int tfe_fieldstat_easy_incrby(struct tfe_fieldstat_easy_t *fieldstat, unsigned int counter_id, long long value, const struct fieldstat_tag tags[], int n_tags, int thread_id);
|
||||
|
||||
|
||||
@@ -63,11 +63,11 @@ struct session_ctx
|
||||
uint8_t is_passthrough;
|
||||
uint8_t protocol;
|
||||
uint8_t metric_hit;
|
||||
uint8_t send_log_flag;
|
||||
char session_addr[128];
|
||||
|
||||
struct packet_info c2s_info;
|
||||
struct packet_info s2c_info;
|
||||
struct timespec metrics_last_time;
|
||||
|
||||
struct metadata *ctrl_meta;
|
||||
|
||||
@@ -93,7 +93,7 @@ struct acceptor_kni_v4
|
||||
|
||||
struct packet_io *io;
|
||||
struct packet_io_fs *packet_io_fs;
|
||||
struct tfe_fieldstat_easy_t *metric;
|
||||
struct metrics *metrics;
|
||||
struct packet_io_thread_ctx work_threads[TFE_THREAD_MAX];
|
||||
|
||||
struct tfe_proxy *ref_proxy;
|
||||
|
||||
@@ -51,6 +51,7 @@ int session_table_delete_by_addr(struct session_table *table, const struct tuple
|
||||
struct session_node *session_table_search_by_id(struct session_table *table, uint64_t session_id);
|
||||
struct session_node *session_table_search_by_addr(struct session_table *table, const struct tuple4 *session_addr);
|
||||
|
||||
void session_foreach(struct session_table *table, void (*func)(struct session_node *, void *), void *ctx);
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user