This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/common/include/tfe_fieldstat.h

52 lines
1.2 KiB
C
Raw Normal View History

#ifndef _TFE_FIELDSTAT_METRIC_H
#define _TFE_FIELDSTAT_METRIC_H
#ifdef __cpluscplus
extern "C"
{
#endif
#include <tfe_utils.h>
#include <MESA/fieldstat.h>
enum metric_columns_index
{
COLUMN_HIT_COUNT = 0,
COLUMN_IN_BYTES,
COLUMN_OUT_BYTES,
COLUMN_IN_PKTS,
COLUMN_OUT_PKTS,
COLUMN_MAX
};
enum metric_tags_index
{
2023-04-26 16:12:29 +08:00
TAG_VSYS_ID = 0,
TAG_RULE_ID,
TAG_ACTION,
TAG_SUB_ACTION,
TAG_PINNING_STATUS,
TAG_MAX
};
struct tfe_fieldstat_metric_t
{
int table_id;
int max_thread;
struct fieldstat_tag **tags;
unsigned int column_array[COLUMN_MAX];
struct fieldstat_dynamic_instance *instance;
};
2024-01-19 10:52:42 +08:00
void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct session_ctx *s_ctx, int thread_id, int is_session_close);
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);
#ifdef __cpluscplus
}
#endif
#endif