@cryptotaxi247 / netdata-1 / commits / cd28c6861

Enable aclk conversation log even without NETDATA_INTERNAL CHECKS (#13917)

enable aclk conversation without INTERNAL CHECKS

Emmanuel Vasilakis committed Nov 3, 2022 at 12:10 UTC cd28c686158840afb020d6b984aa9f96ac656742
2 files changed +16 -12
aclk/aclk_rx_msgs.c
+10 -9
@@ -527,15 +527,16 @@ void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t
527 return;
528 }
529
530 -#ifdef NETDATA_INTERNAL_CHECKS
531 - if (!strncmp(message_type, "cmd", strlen("cmd"))) {
532 - log_aclk_message_bin(msg, msg_len, 0, topic, msg_descriptor->name);
533 - } else {
534 - char *json = protomsg_to_json(msg, msg_len, msg_descriptor->name);
535 - log_aclk_message_bin(json, strlen(json), 0, topic, msg_descriptor->name);
536 - freez(json);
537 - }
538 -#endif
530 +
531 + if (aclklog_enabled) {
532 + if (!strncmp(message_type, "cmd", strlen("cmd"))) {
533 + log_aclk_message_bin(msg, msg_len, 0, topic, msg_descriptor->name);
534 + } else {
535 + char *json = protomsg_to_json(msg, msg_len, msg_descriptor->name);
536 + log_aclk_message_bin(json, strlen(json), 0, topic, msg_descriptor->name);
537 + freez(json);
538 + }
539 + }
540
541 if (aclk_stats_enabled) {
542 ACLK_STATS_LOCK;
aclk/aclk_tx_msgs.c
+6 -3
@@ -39,11 +39,14 @@ uint16_t aclk_send_bin_message_subtopic_pid(mqtt_wss_client client, char *msg, s
39
40 #ifdef NETDATA_INTERNAL_CHECKS
41 aclk_stats_msg_published(packet_id);
42 - char *json = protomsg_to_json(msg, msg_len, msgname);
43 - log_aclk_message_bin(json, strlen(json), 1, topic, msgname);
44 - freez(json);
42 #endif
43
44 + if (aclklog_enabled) {
45 + char *json = protomsg_to_json(msg, msg_len, msgname);
46 + log_aclk_message_bin(json, strlen(json), 1, topic, msgname);
47 + freez(json);
48 + }
49 +
50 return packet_id;
51 }
52