TSG-14786 TFE输出Proxy Rule Hits Metric

This commit is contained in:
fengweihao
2023-04-25 10:13:38 +08:00
parent 95c80c80cf
commit 0bb38a6969
13 changed files with 229 additions and 7 deletions

View File

@@ -0,0 +1,49 @@
#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
{
TAG_RULE_ID = 0,
TAG_PINNING_STATUS,
TAG_ACTION,
TAG_SUB_ACTION,
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;
};
int tfe_fieldstat_metric_incrby(struct tfe_fieldstat_metric_t *fieldstat, unsigned int column_id, long long value, const struct fieldstat_tag 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