From d40b4678e6d32d4353703a5b48dc0c702ff745aa Mon Sep 17 00:00:00 2001 From: liyuxi Date: Thu, 6 Apr 2023 02:24:02 +0000 Subject: [PATCH] fix(file plugin):fix delay --- plugins/file/file_req.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/file/file_req.c b/plugins/file/file_req.c index c35a58aa..3f853cff 100644 --- a/plugins/file/file_req.c +++ b/plugins/file/file_req.c @@ -32,6 +32,10 @@ static void plugin_group_free(neu_plugin_group_t *pgp); int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group) { + neu_adapter_update_metric_cb_t update_metric = + plugin->common.adapter_callbacks->update_metric; + int64_t rtt = NEU_METRIC_LAST_RTT_MS_MAX; + struct file_group_data *gd = NULL; int length = plugin->file_length; @@ -83,6 +87,8 @@ int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group) strncpy(dvalue.value.str, buf, strlen(buf)); fclose(f); + rtt = 1; + dvalue_result: plugin->common.adapter_callbacks->driver.update( plugin->common.adapter, group->group_name, tag->name, dvalue); @@ -90,6 +96,8 @@ int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group) free(buf); } + update_metric(plugin->common.adapter, NEU_METRIC_LAST_RTT_MS, rtt, NULL); + return 0; }