From ab1bb5b7f1c3c3a7b240ab7fc8661459ecd7decb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 20 Jul 2023 06:49:55 +0200 Subject: Adding upstream version 1.41.0. Signed-off-by: Daniel Baumann --- aclk/aclk_rx_msgs.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'aclk/aclk_rx_msgs.c') diff --git a/aclk/aclk_rx_msgs.c b/aclk/aclk_rx_msgs.c index 60bff9ba1..84ade2b34 100644 --- a/aclk/aclk_rx_msgs.c +++ b/aclk/aclk_rx_msgs.c @@ -103,14 +103,14 @@ static inline int aclk_v2_payload_get_query(const char *payload, char **query_ur // TODO better check of URL if(strncmp(payload, ACLK_CLOUD_REQ_V2_PREFIX, strlen(ACLK_CLOUD_REQ_V2_PREFIX))) { errno = 0; - error("Only accepting requests that start with \"%s\" from CLOUD.", ACLK_CLOUD_REQ_V2_PREFIX); + netdata_log_error("Only accepting requests that start with \"%s\" from CLOUD.", ACLK_CLOUD_REQ_V2_PREFIX); return 1; } start = payload + 4; if(!(end = strstr(payload, " HTTP/1.1\x0D\x0A"))) { errno = 0; - error("Doesn't look like HTTP GET request."); + netdata_log_error("Doesn't look like HTTP GET request."); return 1; } @@ -126,7 +126,7 @@ static int aclk_handle_cloud_http_request_v2(struct aclk_request *cloud_to_agent errno = 0; if (cloud_to_agent->version < ACLK_V_COMPRESSION) { - error( + netdata_log_error( "This handler cannot reply to request with version older than %d, received %d.", ACLK_V_COMPRESSION, cloud_to_agent->version); @@ -136,22 +136,22 @@ static int aclk_handle_cloud_http_request_v2(struct aclk_request *cloud_to_agent query = aclk_query_new(HTTP_API_V2); if (unlikely(aclk_extract_v2_data(raw_payload, &query->data.http_api_v2.payload))) { - error("Error extracting payload expected after the JSON dictionary."); + netdata_log_error("Error extracting payload expected after the JSON dictionary."); goto error; } if (unlikely(aclk_v2_payload_get_query(query->data.http_api_v2.payload, &query->dedup_id))) { - error("Could not extract payload from query"); + netdata_log_error("Could not extract payload from query"); goto error; } if (unlikely(!cloud_to_agent->callback_topic)) { - error("Missing callback_topic"); + netdata_log_error("Missing callback_topic"); goto error; } if (unlikely(!cloud_to_agent->msg_id)) { - error("Missing msg_id"); + netdata_log_error("Missing msg_id"); goto error; } @@ -180,7 +180,7 @@ int aclk_handle_cloud_cmd_message(char *payload) return 1; } - debug(D_ACLK, "ACLK incoming 'cmd' message (%s)", payload); + netdata_log_debug(D_ACLK, "ACLK incoming 'cmd' message (%s)", payload); int rc = json_parse(payload, &cloud_to_agent, cloud_to_agent_parse); @@ -250,17 +250,17 @@ int create_node_instance_result(const char *msg, size_t msg_len) return 1; } - debug(D_ACLK, "CreateNodeInstanceResult: guid:%s nodeid:%s", res.machine_guid, res.node_id); + netdata_log_debug(D_ACLK, "CreateNodeInstanceResult: guid:%s nodeid:%s", res.machine_guid, res.node_id); uuid_t host_id, node_id; if (uuid_parse(res.machine_guid, host_id)) { - error("Error parsing machine_guid provided by CreateNodeInstanceResult"); + netdata_log_error("Error parsing machine_guid provided by CreateNodeInstanceResult"); freez(res.machine_guid); freez(res.node_id); return 1; } if (uuid_parse(res.node_id, node_id)) { - error("Error parsing node_id provided by CreateNodeInstanceResult"); + netdata_log_error("Error parsing node_id provided by CreateNodeInstanceResult"); freez(res.machine_guid); freez(res.node_id); return 1; @@ -341,7 +341,7 @@ int start_alarm_streaming(const char *msg, size_t msg_len) { struct start_alarm_streaming res = parse_start_alarm_streaming(msg, msg_len); if (!res.node_id) { - error("Error parsing StartAlarmStreaming"); + netdata_log_error("Error parsing StartAlarmStreaming"); return 1; } aclk_start_alert_streaming(res.node_id, res.resets); @@ -353,7 +353,7 @@ int send_alarm_checkpoint(const char *msg, size_t msg_len) { struct send_alarm_checkpoint sac = parse_send_alarm_checkpoint(msg, msg_len); if (!sac.node_id || !sac.claim_id) { - error("Error parsing SendAlarmCheckpoint"); + netdata_log_error("Error parsing SendAlarmCheckpoint"); freez(sac.node_id); freez(sac.claim_id); return 1; @@ -368,7 +368,7 @@ int send_alarm_configuration(const char *msg, size_t msg_len) { char *config_hash = parse_send_alarm_configuration(msg, msg_len); if (!config_hash || !*config_hash) { - error("Error parsing SendAlarmConfiguration"); + netdata_log_error("Error parsing SendAlarmConfiguration"); freez(config_hash); return 1; } @@ -381,7 +381,7 @@ int send_alarm_snapshot(const char *msg, size_t msg_len) { struct send_alarm_snapshot *sas = parse_send_alarm_snapshot(msg, msg_len); if (!sas->node_id || !sas->claim_id || !sas->snapshot_uuid) { - error("Error parsing SendAlarmSnapshot"); + netdata_log_error("Error parsing SendAlarmSnapshot"); destroy_send_alarm_snapshot(sas); return 1; } @@ -396,13 +396,13 @@ int handle_disconnect_req(const char *msg, size_t msg_len) if (!cmd) return 1; if (cmd->permaban) { - error("Cloud Banned This Agent!"); + netdata_log_error("Cloud Banned This Agent!"); aclk_disable_runtime = 1; } - info("Cloud requested disconnect (EC=%u, \"%s\")", (unsigned int)cmd->error_code, cmd->error_description); + netdata_log_info("Cloud requested disconnect (EC=%u, \"%s\")", (unsigned int)cmd->error_code, cmd->error_description); if (cmd->reconnect_after_s > 0) { aclk_block_until = now_monotonic_sec() + cmd->reconnect_after_s; - info( + netdata_log_info( "Cloud asks not to reconnect for %u seconds. We shall honor that request", (unsigned int)cmd->reconnect_after_s); } @@ -455,7 +455,7 @@ int cancel_pending_req(const char *msg, size_t msg_len) return 1; } - log_access("ACLK CancelPendingRequest REQ: %s, cloud trace-id: %s", cmd.request_id, cmd.trace_id); + netdata_log_access("ACLK CancelPendingRequest REQ: %s, cloud trace-id: %s", cmd.request_id, cmd.trace_id); if (mark_pending_req_cancelled(cmd.request_id)) error_report("CancelPending Request for %s failed. No such pending request.", cmd.request_id); @@ -529,9 +529,9 @@ void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t ACLK_STATS_UNLOCK; } new_cloud_rx_msg_t *msg_descriptor = find_rx_handler_by_hash(simple_hash(message_type)); - debug(D_ACLK, "Got message named '%s' from cloud", message_type); + netdata_log_debug(D_ACLK, "Got message named '%s' from cloud", message_type); if (unlikely(!msg_descriptor)) { - error("Do not know how to handle message of type '%s'. Ignoring", message_type); + netdata_log_error("Do not know how to handle message of type '%s'. Ignoring", message_type); if (aclk_stats_enabled) { ACLK_STATS_LOCK; aclk_metrics_per_sample.cloud_req_err++; @@ -557,7 +557,7 @@ void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t ACLK_STATS_UNLOCK; } if (msg_descriptor->fnc(msg, msg_len)) { - error("Error processing message of type '%s'", message_type); + netdata_log_error("Error processing message of type '%s'", message_type); if (aclk_stats_enabled) { ACLK_STATS_LOCK; aclk_metrics_per_sample.cloud_req_err++; -- cgit v1.2.3