From 9614b509b1ecef494c2321572c22b2177ef8b679 Mon Sep 17 00:00:00 2001 From: "xiang.zhou" Date: Mon, 29 Jan 2024 13:43:54 +0800 Subject: [PATCH] feat:judge cache type when report group --- src/adapter/driver/driver.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/adapter/driver/driver.c b/src/adapter/driver/driver.c index ece307f0..d8b0f1a9 100644 --- a/src/adapter/driver/driver.c +++ b/src/adapter/driver/driver.c @@ -90,6 +90,7 @@ static void read_group(int64_t timestamp, int64_t timeout, neu_driver_cache_t *cache, const char *group, UT_array *tags, UT_array *tag_values); static void read_report_group(int64_t timestamp, int64_t timeout, + neu_tag_cache_type_e cache_type, neu_driver_cache_t *cache, const char *group, UT_array *tags, UT_array *tag_values); static void update(neu_adapter_t *adapter, const char *group, const char *tag, @@ -224,8 +225,9 @@ static void update_im(neu_adapter_t *adapter, const char *group, data->group = strdup(group); utarray_new(data->tags, neu_resp_tag_value_meta_icd()); - read_report_group(global_timestamp, 0, driver->cache, group, tags, - data->tags); + read_report_group(global_timestamp, 0, + neu_adapter_get_tag_cache_type(&driver->adapter), + driver->cache, group, tags, data->tags); if (utarray_len(data->tags) > 0) { group_t *find = NULL; @@ -1510,6 +1512,7 @@ static int report_callback(void *usr_data) read_report_group(global_timestamp, neu_group_get_interval(group->group) * NEU_DRIVER_TAG_CACHE_EXPIRE_TIME, + neu_adapter_get_tag_cache_type(&group->driver->adapter), group->driver->cache, group->name, tags, data->tags); if (utarray_len(data->tags) > 0) { @@ -1683,6 +1686,7 @@ static int read_callback(void *usr_data) } static void read_report_group(int64_t timestamp, int64_t timeout, + neu_tag_cache_type_e cache_type, neu_driver_cache_t *cache, const char *group, UT_array *tags, UT_array *tag_values) { @@ -1775,7 +1779,8 @@ static void read_report_group(int64_t timestamp, int64_t timeout, break; } - if (!neu_tag_attribute_test(tag, NEU_ATTRIBUTE_STATIC) && + if (cache_type != NEU_TAG_CACHE_TYPE_NEVER && + !neu_tag_attribute_test(tag, NEU_ATTRIBUTE_STATIC) && (timestamp - value.timestamp) > timeout && timeout > 0) { if (value.value.type == NEU_TYPE_PTR) { free(value.value.value.ptr.ptr);