adapt fieldstat_easy: rename 'fieldstat_tag' to 'field'

This commit is contained in:
luwenpeng
2024-07-29 14:03:35 +08:00
parent 5c8a88984b
commit 7ef8e44bca
2 changed files with 16 additions and 16 deletions

View File

@@ -120,10 +120,10 @@ struct sf_metrics *sf_metrics_create(const char *profile, struct kafka *kfk)
MESA_load_profile_string_def(profile, "metrics", "device_group", handle->cfg.device_group, sizeof(handle->cfg.device_group), "");
MESA_load_profile_string_def(profile, "metrics", "device_id", handle->cfg.device_id, sizeof(handle->cfg.device_id), "");
const struct fieldstat_tag tags[] = {
{"data_center", TAG_CSTRING, {.value_str = handle->cfg.data_center}},
{"device_group", TAG_CSTRING, {.value_str = handle->cfg.device_group}},
{"device_id", TAG_CSTRING, {.value_str = handle->cfg.device_id}},
const struct field tags[] = {
{"data_center", FIELD_VALUE_CSTRING, {.value_str = handle->cfg.data_center}},
{"device_group", FIELD_VALUE_CSTRING, {.value_str = handle->cfg.device_group}},
{"device_id", FIELD_VALUE_CSTRING, {.value_str = handle->cfg.device_id}},
};
handle->kfk = kfk;
@@ -262,11 +262,11 @@ void sf_metrics_output(struct sf_metrics *handle, uint16_t thr_idx)
continue;
}
const struct fieldstat_tag tags[] = {
{"vsys_id", TAG_INTEGER, {.value_longlong = node->key.vsys_id}},
{"rule_id", TAG_INTEGER, {.value_longlong = (long long)node->key.rule_id}},
{"sff_profile_id", TAG_INTEGER, {.value_longlong = node->key.sff_profile_id}},
{"sf_profile_id", TAG_INTEGER, {.value_longlong = node->key.sf_profile_id}},
const struct field tags[] = {
{"vsys_id", FIELD_VALUE_INTEGER, {.value_longlong = node->key.vsys_id}},
{"rule_id", FIELD_VALUE_INTEGER, {.value_longlong = (long long)node->key.rule_id}},
{"sff_profile_id", FIELD_VALUE_INTEGER, {.value_longlong = node->key.sff_profile_id}},
{"sf_profile_id", FIELD_VALUE_INTEGER, {.value_longlong = node->key.sf_profile_id}},
};
fieldstat_easy_counter_incrby(handle->fs, thr_idx, handle->sent_pkts_idx, tags, sizeof(tags) / sizeof(tags[0]), node->sent_pkts);

View File

@@ -58,10 +58,10 @@ struct sf_status *sf_status_create(const char *profile, struct kafka *kfk)
MESA_load_profile_string_def(profile, "metrics", "device_group", handle->cfg.device_group, sizeof(handle->cfg.device_group), "");
MESA_load_profile_string_def(profile, "metrics", "device_id", handle->cfg.device_id, sizeof(handle->cfg.device_id), "");
const struct fieldstat_tag tags[] = {
{"data_center", TAG_CSTRING, {.value_str = handle->cfg.data_center}},
{"device_group", TAG_CSTRING, {.value_str = handle->cfg.device_group}},
{"device_id", TAG_CSTRING, {.value_str = handle->cfg.device_id}},
const struct field tags[] = {
{"data_center", FIELD_VALUE_CSTRING, {.value_str = handle->cfg.data_center}},
{"device_group", FIELD_VALUE_CSTRING, {.value_str = handle->cfg.device_group}},
{"device_id", FIELD_VALUE_CSTRING, {.value_str = handle->cfg.device_id}},
};
handle->kfk = kfk;
@@ -158,9 +158,9 @@ void sf_status_output(struct sf_status *handle)
struct metric *node = NULL;
HASH_ITER(hh, handle->htable, node, temp)
{
const struct fieldstat_tag tags[] = {
{"vsys_id", TAG_INTEGER, {.value_longlong = node->key.vsys_id}},
{"sf_profile_id", TAG_INTEGER, {.value_longlong = node->key.sf_profile_id}},
const struct field tags[] = {
{"vsys_id", FIELD_VALUE_INTEGER, {.value_longlong = node->key.vsys_id}},
{"sf_profile_id", FIELD_VALUE_INTEGER, {.value_longlong = node->key.sf_profile_id}},
};
fieldstat_easy_counter_set(handle->fs, 0, handle->sf_status_idx, tags, sizeof(tags) / sizeof(tags[0]), node->sf_status);