mirror of
https://github.com/emqx/neuron.git
synced 2026-10-22 01:05:56 +08:00
@@ -72,4 +72,9 @@ typedef enum {
|
||||
NEU_NODE_RUNNING_STATE_STOPPED = 4,
|
||||
} neu_node_running_state_e;
|
||||
|
||||
typedef enum {
|
||||
NEU_TAG_CACHE_TYPE_INTERVAL = 0,
|
||||
NEU_TAG_CACHE_TYPE_NEVER,
|
||||
} neu_tag_cache_type_e;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -116,6 +116,7 @@ typedef struct neu_plugin_module {
|
||||
bool single;
|
||||
const char * single_name;
|
||||
neu_event_timer_type_e timer_type;
|
||||
neu_tag_cache_type_e cache_type;
|
||||
} neu_plugin_module_t;
|
||||
|
||||
inline static neu_plugin_common_t *
|
||||
|
||||
@@ -301,6 +301,11 @@ neu_node_type_e neu_adapter_get_type(neu_adapter_t *adapter)
|
||||
return adapter->module->type;
|
||||
}
|
||||
|
||||
neu_tag_cache_type_e neu_adapter_get_tag_cache_type(neu_adapter_t *adapter)
|
||||
{
|
||||
return adapter->module->cache_type;
|
||||
}
|
||||
|
||||
static int adapter_register_metric(neu_adapter_t *adapter, const char *name,
|
||||
const char *help, neu_metric_type_e type,
|
||||
uint64_t init)
|
||||
|
||||
@@ -75,7 +75,8 @@ int neu_adapter_start(neu_adapter_t *adapter);
|
||||
int neu_adapter_start_single(neu_adapter_t *adapter);
|
||||
int neu_adapter_stop(neu_adapter_t *adapter);
|
||||
|
||||
neu_node_type_e neu_adapter_get_type(neu_adapter_t *adapter);
|
||||
neu_node_type_e neu_adapter_get_type(neu_adapter_t *adapter);
|
||||
neu_tag_cache_type_e neu_adapter_get_tag_cache_type(neu_adapter_t *adapter);
|
||||
|
||||
int neu_adapter_uninit(neu_adapter_t *adapter);
|
||||
void neu_adapter_destroy(neu_adapter_t *adapter);
|
||||
|
||||
@@ -79,6 +79,7 @@ static int report_callback(void *usr_data);
|
||||
static int read_callback(void *usr_data);
|
||||
static int write_callback(void *usr_data);
|
||||
static void read_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, neu_resp_tag_value_meta_t *datas);
|
||||
static int read_report_group(int64_t timestamp, int64_t timeout,
|
||||
@@ -365,6 +366,7 @@ void neu_adapter_driver_read_group(neu_adapter_driver_t *driver,
|
||||
read_group(global_timestamp,
|
||||
neu_group_get_interval(group) *
|
||||
NEU_DRIVER_TAG_CACHE_EXPIRE_TIME,
|
||||
neu_adapter_get_tag_cache_type(&driver->adapter),
|
||||
driver->cache, cmd->group, tags, resp.tags);
|
||||
}
|
||||
|
||||
@@ -1500,6 +1502,7 @@ static int read_report_group(int64_t timestamp, int64_t timeout,
|
||||
}
|
||||
|
||||
static void read_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, neu_resp_tag_value_meta_t *datas)
|
||||
{
|
||||
@@ -1579,7 +1582,8 @@ static void read_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) {
|
||||
datas[index].value.type = NEU_TYPE_ERROR;
|
||||
datas[index].value.value.i32 = NEU_ERR_PLUGIN_TAG_VALUE_EXPIRED;
|
||||
|
||||
Reference in New Issue
Block a user