适配fieldstat4,调整结构体名称
This commit is contained in:
@@ -68,8 +68,8 @@ int tfe_fieldstat_intercept_incrby(struct fieldstat_easy_intercept *metrics, voi
|
||||
int out_pkts = 0;
|
||||
int out_bytes = 0;
|
||||
|
||||
// incoming : E2I <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// outgoing : I2E <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// incoming : E2I 的流量
|
||||
// outgoing : I2E 的流量
|
||||
// first_ctr_packet_dir <==> client hello packet dir
|
||||
// 1: E2I 0:I2E
|
||||
if (c2s_dir == 1)
|
||||
@@ -95,19 +95,19 @@ int tfe_fieldstat_intercept_incrby(struct fieldstat_easy_intercept *metrics, voi
|
||||
}
|
||||
|
||||
int nr_tags = 0;
|
||||
struct fieldstat_tag tags[5] = {0};
|
||||
FIELDSTAT_TAG_INIT(tags, nr_tags, "vsys_id", TAG_INTEGER, vsys_id);
|
||||
struct field tags[5] = {0};
|
||||
FIELDSTAT_TAG_INIT(tags, nr_tags, "vsys_id", FIELD_VALUE_INTEGER, vsys_id);
|
||||
nr_tags++;
|
||||
FIELDSTAT_TAG_INIT(tags, nr_tags, "rule_id", TAG_INTEGER, rule_id);
|
||||
FIELDSTAT_TAG_INIT(tags, nr_tags, "rule_id", FIELD_VALUE_INTEGER, rule_id);
|
||||
nr_tags++;
|
||||
uint8_t pinning_status = 0;
|
||||
if (tfe_cmsg_get_value(cmsg, TFE_CMSG_SSL_PINNING_STATE, (unsigned char *)&pinning_status, sizeof(pinning_status), &out_size) == 0)
|
||||
{
|
||||
FIELDSTAT_TAG_INIT(tags, nr_tags, "pinning_status", TAG_INTEGER, pinning_status);
|
||||
FIELDSTAT_TAG_INIT(tags, nr_tags, "pinning_status", FIELD_VALUE_INTEGER, pinning_status);
|
||||
nr_tags++;
|
||||
}
|
||||
// action : 2 Intercept; 3 No Intercept
|
||||
FIELDSTAT_TAG_INIT(tags, nr_tags, "action", TAG_INTEGER, (hit_no_intercept == 1 ? 3 : 2));
|
||||
FIELDSTAT_TAG_INIT(tags, nr_tags, "action", FIELD_VALUE_INTEGER, (hit_no_intercept == 1 ? 3 : 2));
|
||||
nr_tags++;
|
||||
|
||||
if (hit_count > 0)
|
||||
@@ -132,7 +132,7 @@ int tfe_fieldstat_get_output_interval(struct fieldstat_easy_intercept *fieldstat
|
||||
return fieldstat->output_fs_interval_ms;
|
||||
}
|
||||
|
||||
int tfe_fieldstat_manipulation_incrby(struct filedstat_easy_manipulation *fieldstat, unsigned int counter_id, long long value, const struct fieldstat_tag tags[], int n_tags, int thread_id)
|
||||
int tfe_fieldstat_manipulation_incrby(struct filedstat_easy_manipulation *fieldstat, unsigned int counter_id, long long value, const struct field tags[], int n_tags, int thread_id)
|
||||
{
|
||||
return fieldstat_easy_counter_incrby(fieldstat->fs, thread_id, counter_id, tags, (size_t)n_tags, value);
|
||||
}
|
||||
@@ -187,10 +187,10 @@ struct fieldstat_easy_intercept *tfe_fieldstat_easy_intercept_create(char *app_n
|
||||
{
|
||||
struct fieldstat_easy_intercept *fieldstat = ALLOC(struct fieldstat_easy_intercept, 1);
|
||||
|
||||
const struct fieldstat_tag tags[] = {
|
||||
{"data_center", TAG_CSTRING, {.value_str = tfe_get_data_center()}},
|
||||
{"device_group", TAG_CSTRING, {.value_str = tfe_get_device_group()}},
|
||||
{"device_id", TAG_CSTRING, {.value_str = tfe_get_device_id()}},
|
||||
const struct field tags[] = {
|
||||
{"data_center", FIELD_VALUE_CSTRING, {.value_str = tfe_get_data_center()}},
|
||||
{"device_group", FIELD_VALUE_CSTRING, {.value_str = tfe_get_device_group()}},
|
||||
{"device_id", FIELD_VALUE_CSTRING, {.value_str = tfe_get_device_id()}},
|
||||
};
|
||||
|
||||
fieldstat->fs = fieldstat_easy_new(max_thread, app_name, tags, sizeof(tags) / sizeof(tags[0]));
|
||||
@@ -213,14 +213,14 @@ struct fieldstat_easy_intercept *tfe_fieldstat_easy_intercept_create(char *app_n
|
||||
struct filedstat_easy_manipulation *tfe_fieldstat_easy_manipulation_create(char *app_name, char *outpath, int cycle, int max_thread, void *local_logger)
|
||||
{
|
||||
const char *counter_field[COLUMN_MAX] = {"hit_count", "in_bytes", "out_bytes", "in_pkts", "out_pkts"};
|
||||
struct fieldstat_tag metric_tags[TAG_MAX - 1] = {{"vsys_id", TAG_INTEGER, -1}, {"rule_id", TAG_INTEGER, -1}, {"action", TAG_INTEGER, -1}, {"sub_action", TAG_CSTRING, -1}};
|
||||
struct field metric_tags[TAG_MAX - 1] = {{"vsys_id", FIELD_VALUE_INTEGER, -1}, {"rule_id", FIELD_VALUE_INTEGER, -1}, {"action", FIELD_VALUE_INTEGER, -1}, {"sub_action", FIELD_VALUE_CSTRING, -1}};
|
||||
|
||||
struct filedstat_easy_manipulation *fieldstat = ALLOC(struct filedstat_easy_manipulation, 1);
|
||||
|
||||
const struct fieldstat_tag tags[] = {
|
||||
{"data_center", TAG_CSTRING, {.value_str = tfe_get_data_center()}},
|
||||
{"device_group", TAG_CSTRING, {.value_str = tfe_get_device_group()}},
|
||||
{"device_id", TAG_CSTRING, {.value_str = tfe_get_device_id()}},
|
||||
const struct field tags[] = {
|
||||
{"data_center", FIELD_VALUE_CSTRING, {.value_str = tfe_get_data_center()}},
|
||||
{"device_group", FIELD_VALUE_CSTRING, {.value_str = tfe_get_device_group()}},
|
||||
{"device_id", FIELD_VALUE_CSTRING, {.value_str = tfe_get_device_id()}},
|
||||
};
|
||||
|
||||
fieldstat->fs = fieldstat_easy_new(max_thread, app_name, tags, sizeof(tags) / sizeof(tags[0]));
|
||||
@@ -246,11 +246,11 @@ struct filedstat_easy_manipulation *tfe_fieldstat_easy_manipulation_create(char
|
||||
}
|
||||
}
|
||||
|
||||
fieldstat->tags = ALLOC(struct fieldstat_tag*, max_thread);
|
||||
fieldstat->tags = ALLOC(struct field*, max_thread);
|
||||
for (int i = 0; i < max_thread; i++)
|
||||
{
|
||||
fieldstat->tags[i] = ALLOC(struct fieldstat_tag, TAG_MAX-1);
|
||||
memcpy(fieldstat->tags[i], metric_tags, sizeof(struct fieldstat_tag) * (size_t)(TAG_MAX-1));
|
||||
fieldstat->tags[i] = ALLOC(struct field, TAG_MAX-1);
|
||||
memcpy(fieldstat->tags[i], metric_tags, sizeof(struct field) * (size_t)(TAG_MAX-1));
|
||||
}
|
||||
|
||||
return fieldstat;
|
||||
|
||||
Reference in New Issue
Block a user