summaryrefslogtreecommitdiffstats
path: root/aclk/aclk_query.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-20 04:50:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-20 04:50:01 +0000
commitcd4377fab21e0f500bef7f06543fa848a039c1e0 (patch)
treeba00a55e430c052d6bed0b61c0f8bbe8ebedd313 /aclk/aclk_query.c
parentReleasing debian version 1.40.1-1. (diff)
downloadnetdata-cd4377fab21e0f500bef7f06543fa848a039c1e0.tar.xz
netdata-cd4377fab21e0f500bef7f06543fa848a039c1e0.zip
Merging upstream version 1.41.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'aclk/aclk_query.c')
-rw-r--r--aclk/aclk_query.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/aclk/aclk_query.c b/aclk/aclk_query.c
index 0698c2d60..07d571be1 100644
--- a/aclk/aclk_query.c
+++ b/aclk/aclk_query.c
@@ -110,7 +110,7 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
usec_t t;
web_client_timeout_checkpoint_set(w, query->timeout);
if(web_client_timeout_checkpoint_and_check(w, &t)) {
- log_access("QUERY CANCELED: QUEUE TIME EXCEEDED %llu ms (LIMIT %d ms)", t / USEC_PER_MS, query->timeout);
+ netdata_log_access("QUERY CANCELED: QUEUE TIME EXCEEDED %llu ms (LIMIT %d ms)", t / USEC_PER_MS, query->timeout);
retval = 1;
w->response.code = HTTP_RESP_BACKEND_FETCH_FAILED;
aclk_http_msg_v2_err(query_thr->client, query->callback_topic, query->msg_id, w->response.code, CLOUD_EC_SND_TIMEOUT, CLOUD_EMSG_SND_TIMEOUT, NULL, 0);
@@ -128,7 +128,7 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
ACLK_STATS_UNLOCK;
}
- w->response.code = web_client_api_request_with_node_selection(localhost, w, path);
+ w->response.code = (short)web_client_api_request_with_node_selection(localhost, w, path);
web_client_timeout_checkpoint_response_ready(w, &t);
if(buffer_strlen(w->response.data) > ACLK_MAX_WEB_RESPONSE_SIZE) {
@@ -164,7 +164,7 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
w->response.zinitialized = true;
w->response.zoutput = true;
} else
- error("Failed to initialize zlib. Proceeding without compression.");
+ netdata_log_error("Failed to initialize zlib. Proceeding without compression.");
}
}
@@ -177,9 +177,9 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
z_ret = deflate(&w->response.zstream, Z_FINISH);
if(z_ret < 0) {
if(w->response.zstream.msg)
- error("Error compressing body. ZLIB error: \"%s\"", w->response.zstream.msg);
+ netdata_log_error("Error compressing body. ZLIB error: \"%s\"", w->response.zstream.msg);
else
- error("Unknown error during zlib compression.");
+ netdata_log_error("Unknown error during zlib compression.");
retval = 1;
w->response.code = 500;
aclk_http_msg_v2_err(query_thr->client, query->callback_topic, query->msg_id, w->response.code, CLOUD_EC_ZLIB_ERROR, CLOUD_EMSG_ZLIB_ERROR, NULL, 0);
@@ -197,7 +197,6 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
z_buffer = NULL;
}
- w->response.data->date = w->timings.tv_ready.tv_sec;
web_client_build_http_header(w);
local_buffer = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE, &netdata_buffers_statistics.buffers_aclk);
local_buffer->content_type = CT_APPLICATION_JSON;
@@ -222,7 +221,7 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query)
cleanup:
now_monotonic_high_precision_timeval(&tv);
- log_access("%llu: %d '[ACLK]:%d' '%s' (sent/all = %zu/%zu bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %d '%s'",
+ netdata_log_access("%llu: %d '[ACLK]:%d' '%s' (sent/all = %zu/%zu bytes %0.0f%%, prep/sent/total = %0.2f/%0.2f/%0.2f ms) %d '%s'",
w->id
, gettid()
, query_thr->idx
@@ -286,10 +285,10 @@ static void aclk_query_process_msg(struct aclk_query_thread *query_thr, aclk_que
worker_is_busy(query->type);
if (query->type == HTTP_API_V2) {
- debug(D_ACLK, "Processing Queued Message of type: \"http_api_request_v2\"");
+ netdata_log_debug(D_ACLK, "Processing Queued Message of type: \"http_api_request_v2\"");
http_api_v2(query_thr, query);
} else {
- debug(D_ACLK, "Processing Queued Message of type: \"%s\"", query->data.bin_payload.msg_name);
+ netdata_log_debug(D_ACLK, "Processing Queued Message of type: \"%s\"", query->data.bin_payload.msg_name);
send_bin_msg(query_thr, query);
}
@@ -357,7 +356,7 @@ void *aclk_query_main_thread(void *ptr)
#define TASK_LEN_MAX 22
void aclk_query_threads_start(struct aclk_query_threads *query_threads, mqtt_wss_client client)
{
- info("Starting %d query threads.", query_threads->count);
+ netdata_log_info("Starting %d query threads.", query_threads->count);
char thread_name[TASK_LEN_MAX];
query_threads->thread_list = callocz(query_threads->count, sizeof(struct aclk_query_thread));
@@ -366,7 +365,7 @@ void aclk_query_threads_start(struct aclk_query_threads *query_threads, mqtt_wss
query_threads->thread_list[i].client = client;
if(unlikely(snprintfz(thread_name, TASK_LEN_MAX, "ACLK_QRY[%d]", i) < 0))
- error("snprintf encoding error");
+ netdata_log_error("snprintf encoding error");
netdata_thread_create(
&query_threads->thread_list[i].thread, thread_name, NETDATA_THREAD_OPTION_JOINABLE, aclk_query_main_thread,
&query_threads->thread_list[i]);