From 7ef8e44bca6bac3c905ed8d6a11cadd6edac156b Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Mon, 29 Jul 2024 14:03:35 +0800 Subject: [PATCH] adapt fieldstat_easy: rename 'fieldstat_tag' to 'field' --- platform/src/sf_metrics.cpp | 18 +++++++++--------- platform/src/sf_status.cpp | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/platform/src/sf_metrics.cpp b/platform/src/sf_metrics.cpp index e56d05d..4b0f894 100644 --- a/platform/src/sf_metrics.cpp +++ b/platform/src/sf_metrics.cpp @@ -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); diff --git a/platform/src/sf_status.cpp b/platform/src/sf_status.cpp index c91cc2f..21a49de 100644 --- a/platform/src/sf_status.cpp +++ b/platform/src/sf_status.cpp @@ -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);