diff options
Diffstat (limited to '')
-rw-r--r-- | src/plugins.d/pluginsd_functions.c (renamed from src/collectors/plugins.d/pluginsd_functions.c) | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/collectors/plugins.d/pluginsd_functions.c b/src/plugins.d/pluginsd_functions.c index 4ea6d481..26477a7d 100644 --- a/src/collectors/plugins.d/pluginsd_functions.c +++ b/src/plugins.d/pluginsd_functions.c @@ -59,7 +59,7 @@ static void inflight_functions_insert_callback(const DICTIONARY_ITEM *item, void pf->code = HTTP_RESP_SERVICE_UNAVAILABLE; netdata_log_error("FUNCTION '%s': failed to send it to the plugin, error %zd", string2str(pf->function), ret); - rrd_call_function_error(pf->result_body_wb, "Failed to communicate with collector", pf->code); + rrd_call_function_error(pf->result_body_wb, "Failed to send this request to the plugin that offered it.", pf->code); } else { pf->sent_successfully = true; @@ -75,7 +75,7 @@ static bool inflight_functions_conflict_callback(const DICTIONARY_ITEM *item __m struct inflight_function *pf = new_func; netdata_log_error("PLUGINSD_PARSER: duplicate UUID on pending function '%s' detected. Ignoring the second one.", string2str(pf->function)); - pf->code = rrd_call_function_error(pf->result_body_wb, "This request is already in progress", HTTP_RESP_BAD_REQUEST); + pf->code = rrd_call_function_error(pf->result_body_wb, "This transaction is already in progress.", HTTP_RESP_BAD_REQUEST); pf->result.cb(pf->result_body_wb, pf->code, pf->result.data); string_freez(pf->function); @@ -94,7 +94,7 @@ static void inflight_functions_delete_callback(const DICTIONARY_ITEM *item __may pf->sent_monotonic_ut - pf->started_monotonic_ut, now_realtime_usec() - pf->sent_monotonic_ut); if(pf->code == HTTP_RESP_SERVICE_UNAVAILABLE && !buffer_strlen(pf->result_body_wb)) - rrd_call_function_error(pf->result_body_wb, "The plugin exited while servicing this call.", pf->code); + rrd_call_function_error(pf->result_body_wb, "The plugin that was servicing this request, exited before responding.", pf->code); pf->result.cb(pf->result_body_wb, pf->code, pf->result.data); @@ -127,7 +127,7 @@ void pluginsd_inflight_functions_garbage_collect(PARSER *parser, usec_t now_ut) if(!buffer_strlen(pf->result_body_wb) || pf->code == HTTP_RESP_OK) pf->code = rrd_call_function_error(pf->result_body_wb, - "Timeout waiting for collector response.", + "Timeout waiting for a response.", HTTP_RESP_GATEWAY_TIMEOUT); dictionary_del(parser->inflight.functions, pf_dfe.name); @@ -285,6 +285,7 @@ PARSER_RC pluginsd_function(char **words, size_t num_words, PARSER *parser) { char *tags = get_word(words, num_words, i++); char *access_str = get_word(words, num_words, i++); char *priority_str = get_word(words, num_words, i++); + char *version_str = get_word(words, num_words, i++); RRDHOST *host = pluginsd_require_scope_host(parser, PLUGINSD_KEYWORD_FUNCTION); if(!host) return PARSER_RC_ERROR; @@ -293,12 +294,14 @@ PARSER_RC pluginsd_function(char **words, size_t num_words, PARSER *parser) { if(!st) global = true; if (unlikely(!timeout_str || !name || !help || (!global && !st))) { - netdata_log_error("PLUGINSD: 'host:%s/chart:%s' got a FUNCTION, without providing the required data (global = '%s', name = '%s', timeout = '%s', help = '%s'). Ignoring it.", + netdata_log_error("PLUGINSD: 'host:%s/chart:%s' got a FUNCTION, without providing the required data (global = '%s', name = '%s', timeout = '%s', priority = '%s', version = '%s', help = '%s'). Ignoring it.", rrdhost_hostname(host), st?rrdset_id(st):"(unset)", global?"yes":"no", name?name:"(unset)", - timeout_str ? timeout_str : "(unset)", + timeout_str ? timeout_str : "(unset)", + priority_str ? priority_str : "(unset)", + version_str ? version_str : "(unset)", help?help:"(unset)" ); return PARSER_RC_ERROR; @@ -318,7 +321,11 @@ PARSER_RC pluginsd_function(char **words, size_t num_words, PARSER *parser) { priority = RRDFUNCTIONS_PRIORITY_DEFAULT; } - rrd_function_add(host, st, name, timeout_s, priority, help, tags, + uint32_t version = RRDFUNCTIONS_VERSION_DEFAULT; + if(version_str && *version_str) + version = str2u(version_str); + + rrd_function_add(host, st, name, timeout_s, priority, version, help, tags, http_access_from_hex_mapping_old_roles(access_str), false, pluginsd_function_execute_cb, parser); |