Makes New Cloud architecture optional for ACLK-NG (#11587)
ACLK-NG supports both new and old cloud protocol. Protobuf and C++ compiler are required only for new cloud protocol. There is no reason to skip building whole ACLK-NG when protobuf is missing.
Timotej S committed
Sep 29, 2021 at 17:53 UTC
dad48421a6b3482f9cb71973885cf1160408855f
16 files changed
+169
-88
Makefile.am
+11
-5
@@ -588,10 +588,6 @@ ACLK_NG_FILES = \
588
aclk/aclk_rx_msgs.h \
589
aclk/https_client.c \
590
aclk/https_client.h \
591
- aclk/aclk_charts_api.c \
592
- aclk/aclk_charts_api.h \
593
- aclk/aclk_alarm_api.c \
594
- aclk/aclk_alarm_api.h \
591
mqtt_websockets/src/mqtt_wss_client.c \
592
mqtt_websockets/src/include/mqtt_wss_client.h \
593
mqtt_websockets/src/mqtt_wss_log.c \
@@ -602,7 +598,15 @@ ACLK_NG_FILES = \
598
mqtt_websockets/c-rbuf/include/ringbuffer.h \
599
mqtt_websockets/c-rbuf/src/ringbuffer_internal.h \
600
mqtt_websockets/MQTT-C/src/mqtt.c \
605
- mqtt_websockets/MQTT-C/include/mqtt.h \
601
+ mqtt_websockets/MQTT-C/include/mqtt.h
602
+ $(NULL)
603
+
604
+if ENABLE_NEW_CLOUD_PROTOCOL
605
+ACLK_NG_FILES += \
606
+ aclk/aclk_charts_api.c \
607
+ aclk/aclk_charts_api.h \
608
+ aclk/aclk_alarm_api.c \
609
+ aclk/aclk_alarm_api.h \
610
aclk/schema-wrappers/connection.cc \
611
aclk/schema-wrappers/connection.h \
612
aclk/schema-wrappers/node_connection.cc \
@@ -712,6 +716,8 @@ aclk/aclk-schemas/proto/nodeinstance/info/v1/info.pb.cc \
716
aclk/aclk-schemas/proto/nodeinstance/info/v1/info.pb.h: aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto
717
$(PROTOC) -I=aclk/aclk-schemas --cpp_out=$(builddir)/aclk/aclk-schemas $^
718
719
+endif #ENABLE_NEW_CLOUD_PROTOCOL
720
+
721
endif #ACLK_NG
722
723
if ENABLE_ACLK
aclk/aclk.c
+35
-3
@@ -223,7 +223,7 @@ static void msg_callback(const char *topic, const void *msg, size_t msglen, int
223
aclk_handle_cloud_message(cmsg);
224
}
225
226
-
226
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
227
static void msg_callback_new(const char *topic, const void *msg, size_t msglen, int qos)
228
{
229
if (msglen > RX_MSGLEN_MAX)
@@ -261,6 +261,7 @@ static void msg_callback_new(const char *topic, const void *msg, size_t msglen,
261
262
aclk_handle_new_cloud_msg(msgtype, msg, msglen);
263
}
264
+#endif
265
266
static void puback_callback(uint16_t packet_id)
267
{
@@ -352,6 +353,7 @@ static inline void mqtt_connected_actions(mqtt_wss_client client)
353
else
354
mqtt_wss_subscribe(client, topic, 1);
355
356
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
357
if (aclk_use_new_cloud_arch) {
358
topic = aclk_get_topic(ACLK_TOPICID_CMD_NG_V1);
359
if (!topic)
@@ -359,21 +361,26 @@ static inline void mqtt_connected_actions(mqtt_wss_client client)
361
else
362
mqtt_wss_subscribe(client, topic, 1);
363
}
364
+#endif
365
366
aclk_stats_upd_online(1);
367
aclk_connected = 1;
368
aclk_pubacks_per_conn = 0;
369
370
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
371
if (!aclk_use_new_cloud_arch) {
372
+#endif
373
ACLK_SHARED_STATE_LOCK;
374
if (aclk_shared_state.agent_state != ACLK_HOST_INITIALIZING) {
375
error("Sending `connect` payload immediately as popcorning was finished already.");
376
queue_connect_payloads();
377
}
378
ACLK_SHARED_STATE_UNLOCK;
379
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
380
} else {
381
aclk_send_agent_connection_update(client, 1);
382
}
383
+#endif
384
}
385
386
/* Waits until agent is ready or needs to exit
@@ -416,9 +423,11 @@ void aclk_graceful_disconnect(mqtt_wss_client client)
423
error("Preparing to Gracefully Shutdown the ACLK");
424
aclk_queue_lock();
425
aclk_queue_flush();
426
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
427
if (aclk_use_new_cloud_arch)
428
aclk_shared_state.mqtt_shutdown_msg_id = aclk_send_agent_connection_update(client, 0);
429
else
430
+#endif
431
aclk_shared_state.mqtt_shutdown_msg_id = aclk_send_app_layer_disconnect(client, "graceful");
432
433
time_t t = now_monotonic_sec();
@@ -626,13 +635,17 @@ static int aclk_attempt_to_connect(mqtt_wss_client client)
635
aclk_session_sec = aclk_session_newarch / USEC_PER_SEC;
636
aclk_session_us = aclk_session_newarch % USEC_PER_SEC;
637
638
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
639
if (aclk_use_new_cloud_arch) {
640
mqtt_conn_params.will_msg = aclk_generate_lwt(&mqtt_conn_params.will_msg_len);
641
} else {
642
+#endif
643
lwt = aclk_generate_disconnect(NULL);
644
mqtt_conn_params.will_msg = json_object_to_json_string_ext(lwt, JSON_C_TO_STRING_PLAIN);
645
mqtt_conn_params.will_msg_len = strlen(mqtt_conn_params.will_msg);
646
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
647
}
648
+#endif
649
650
#ifdef ACLK_DISABLE_CHALLENGE
651
ret = mqtt_wss_connect(client, base_url.host, base_url.port, &mqtt_conn_params, ACLK_SSL_FLAGS, &proxy_conf);
@@ -675,7 +688,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client)
688
*/
689
void *aclk_main(void *ptr)
690
{
678
-#ifdef ACLK_NEWARCH_DEVMODE
691
+#if defined(ENABLE_NEW_CLOUD_PROTOCOL) && defined(ACLK_NEWARCH_DEVMODE)
692
aclk_use_new_cloud_arch = 1;
693
#endif
694
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
@@ -711,7 +724,11 @@ void *aclk_main(void *ptr)
724
if (wait_till_agent_claim_ready())
725
goto exit;
726
727
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
728
if (!(mqttwss_client = mqtt_wss_new("mqtt_wss", aclk_mqtt_wss_log_cb, (aclk_use_new_cloud_arch ? msg_callback_new : msg_callback), puback_callback))) {
729
+#else
730
+ if (!(mqttwss_client = mqtt_wss_new("mqtt_wss", aclk_mqtt_wss_log_cb, msg_callback, puback_callback))) {
731
+#endif
732
error("Couldn't initialize MQTT_WSS network library");
733
goto exit;
734
}
@@ -1028,6 +1045,11 @@ char *ng_aclk_state(void)
1045
buffer_strcat(wb,
1046
"ACLK Available: Yes\n"
1047
"ACLK Implementation: Next Generation\n"
1048
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
1049
+ "New Cloud Protocol Support: Yes\n"
1050
+#else
1051
+ "New Cloud Protocol Support: No\n"
1052
+#endif
1053
"Claimed: "
1054
);
1055
@@ -1039,7 +1061,7 @@ char *ng_aclk_state(void)
1061
freez(agent_id);
1062
}
1063
1042
- buffer_sprintf(wb, "Online: %s", aclk_connected ? "Yes" : "No");
1064
+ buffer_sprintf(wb, "Online: %s\nUsed Cloud Protocol: %s", aclk_connected ? "Yes" : "No", aclk_use_new_cloud_arch ? "New" : "Legacy");
1065
1066
ret = strdupz(buffer_tostring(wb));
1067
buffer_free(wb);
@@ -1056,6 +1078,13 @@ char *ng_aclk_state_json(void)
1078
tmp = json_object_new_string("Next Generation");
1079
json_object_object_add(msg, "aclk-implementation", tmp);
1080
1081
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
1082
+ tmp = json_object_new_boolean(1);
1083
+#else
1084
+ tmp = json_object_new_boolean(0);
1085
+#endif
1086
+ json_object_object_add(msg, "new-cloud-protocol-supported", tmp);
1087
+
1088
char *agent_id = is_agent_claimed();
1089
tmp = json_object_new_boolean(agent_id != NULL);
1090
json_object_object_add(msg, "agent-claimed", tmp);
@@ -1070,6 +1099,9 @@ char *ng_aclk_state_json(void)
1099
tmp = json_object_new_boolean(aclk_connected);
1100
json_object_object_add(msg, "online", tmp);
1101
1102
+ tmp = json_object_new_string(aclk_use_new_cloud_arch ? "New" : "Legacy");
1103
+ json_object_object_add(msg, "used-cloud-protocol", tmp);
1104
+
1105
char *str = strdupz(json_object_to_json_string_ext(msg, JSON_C_TO_STRING_PLAIN));
1106
json_object_put(msg);
1107
return str;
aclk/aclk_otp.c
-6
@@ -9,12 +9,6 @@
9
10
#include "mqtt_websockets/c-rbuf/include/ringbuffer.h"
11
12
-// CentOS 7 has older version that doesn't define this
13
-// same goes for MacOS
14
-#ifndef UUID_STR_LEN
15
-#define UUID_STR_LEN 37
16
-#endif
17
-
12
struct dictionary_singleton {
13
char *key;
14
char *result;
aclk/aclk_query.c
+4
@@ -257,6 +257,7 @@ static int alarm_state_update_query(struct aclk_query_thread *query_thr, aclk_qu
257
return 0;
258
}
259
260
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
261
static int register_node(struct aclk_query_thread *query_thr, aclk_query_t query) {
262
// TODO create a pending registrations list
263
// with some timeouts to detect registration requests that
@@ -279,6 +280,7 @@ static int send_bin_msg(struct aclk_query_thread *query_thr, aclk_query_t query)
280
aclk_send_bin_message_subtopic_pid(query_thr->client, query->data.bin_payload.payload, query->data.bin_payload.size, query->data.bin_payload.topic, query->data.bin_payload.msg_name);
281
return 0;
282
}
283
+#endif
284
285
aclk_query_handler aclk_query_handlers[] = {
286
{ .type = HTTP_API_V2, .name = "http api request v2", .fnc = http_api_v2 },
@@ -287,6 +289,7 @@ aclk_query_handler aclk_query_handlers[] = {
289
{ .type = METADATA_ALARMS, .name = "alarms metadata", .fnc = alarms_metadata },
290
{ .type = CHART_NEW, .name = "chart new", .fnc = chart_query },
291
{ .type = CHART_DEL, .name = "chart delete", .fnc = info_metadata },
292
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
293
{ .type = REGISTER_NODE, .name = "register node", .fnc = register_node },
294
{ .type = NODE_STATE_UPDATE, .name = "node state update", .fnc = node_state_update },
295
{ .type = CHART_DIMS_UPDATE, .name = "chart and dim update bin", .fnc = send_bin_msg },
@@ -296,6 +299,7 @@ aclk_query_handler aclk_query_handlers[] = {
299
{ .type = UPDATE_NODE_INFO, .name = "update node info", .fnc = send_bin_msg },
300
{ .type = ALARM_LOG_HEALTH, .name = "alarm log health", .fnc = send_bin_msg },
301
{ .type = ALARM_PROVIDE_CFG, .name = "provide alarm config", .fnc = send_bin_msg },
302
+#endif
303
{ .type = UNKNOWN, .name = NULL, .fnc = NULL }
304
};
305
aclk/aclk_rx_msgs.c
+2
@@ -260,6 +260,7 @@ err_cleanup_nojson:
260
return 1;
261
}
262
263
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
264
void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t msg_len)
265
{
266
// TODO do the look up table with hashes to optimize when there are more
@@ -331,3 +332,4 @@ void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t
332
333
error ("Unknown new cloud arch message type received \"%s\"", message_type);
334
}
335
+#endif
aclk/aclk_rx_msgs.h
+2
@@ -10,6 +10,8 @@
10
11
int aclk_handle_cloud_message(char *payload);
12
13
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
14
void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t msg_len);
15
+#endif
16
17
#endif /* ACLK_RX_MSGS_H */
aclk/aclk_tx_msgs.c
+2
@@ -403,6 +403,7 @@ int aclk_send_app_layer_disconnect(mqtt_wss_client client, const char *message)
403
return pid;
404
}
405
406
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
407
// new protobuf msgs
408
uint16_t aclk_send_agent_connection_update(mqtt_wss_client client, int reachable) {
409
size_t len;
@@ -481,6 +482,7 @@ void aclk_generate_node_state_update(mqtt_wss_client client, node_instance_conne
482
aclk_send_bin_message_subtopic_pid(client, msg, len, ACLK_TOPICID_NODE_CONN, "UpdateNodeInstanceConnection");
483
freez(msg);
484
}
485
+#endif /* ENABLE_NEW_CLOUD_PROTOCOL */
486
487
#ifndef __GNUC__
488
#pragma endregion
aclk/aclk_tx_msgs.h
+2
@@ -23,11 +23,13 @@ void aclk_alarm_state_msg(mqtt_wss_client client, json_object *msg);
23
json_object *aclk_generate_disconnect(const char *message);
24
int aclk_send_app_layer_disconnect(mqtt_wss_client client, const char *message);
25
26
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
27
// new protobuf msgs
28
uint16_t aclk_send_agent_connection_update(mqtt_wss_client client, int reachable);
29
char *aclk_generate_lwt(size_t *size);
30
31
void aclk_generate_node_registration(mqtt_wss_client client, node_instance_creation_t *node_creation);
32
void aclk_generate_node_state_update(mqtt_wss_client client, node_instance_connection_t *node_connection);
33
+#endif
34
35
#endif
aclk/aclk_util.c
-6
@@ -4,12 +4,6 @@
4
5
#include "daemon/common.h"
6
7
-// CentOS 7 has older version that doesn't define this
8
-// same goes for MacOS
9
-#ifndef UUID_STR_LEN
10
-#define UUID_STR_LEN 37
11
-#endif
12
-
7
int aclk_use_new_cloud_arch = 0;
8
usec_t aclk_session_newarch = 0;
9
aclk/aclk_util.h
+6
@@ -5,6 +5,12 @@
5
#include "libnetdata/libnetdata.h"
6
#include "mqtt_wss_client.h"
7
8
+// CentOS 7 has older version that doesn't define this
9
+// same goes for MacOS
10
+#ifndef UUID_STR_LEN
11
+#define UUID_STR_LEN 37
12
+#endif
13
+
14
// Helper stuff which should not have any further inside ACLK dependency
15
// and are supposed not to be needed outside of ACLK
16
configure.ac
+71
-48
@@ -216,6 +216,14 @@ AC_ARG_WITH(
216
[aclk_ng="detect"]
217
)
218
219
+AC_ARG_WITH(
220
+ [new-cloud-protocol],
221
+ [AS_HELP_STRING([--with-new-cloud-protocol],
222
+ [Requires New Cloud Protocol support to be built])],
223
+ [new_cloud_protocol="$withval"],
224
+ [new_cloud_protocol="detect"]
225
+)
226
+
227
if test "${enable_cloud}" = "no"; then
228
AC_DEFINE([DISABLE_CLOUD], [1], [disable netdata cloud functionality])
229
fi
@@ -736,49 +744,6 @@ if test "$enable_cloud" != "no" -a "$aclk_ng" != "no"; then
744
else
745
AC_MSG_RESULT([yes])
746
fi
739
- AC_MSG_CHECKING([if protobuf available for ACLK Next Generation])
740
- if test "${have_libprotobuf}" != "yes"; then
741
- AC_MSG_RESULT([no])
742
- can_enable_ng="no"
743
- else
744
- AC_MSG_RESULT([yes])
745
- fi
746
- AC_MSG_CHECKING([if protoc available for ACLK Next Generation])
747
- if test "${have_protoc}" != "yes"; then
748
- AC_MSG_RESULT([no])
749
- can_enable_ng="no"
750
- else
751
- AC_MSG_RESULT([yes])
752
- fi
753
- AC_MSG_CHECKING([if C++ compiler available for ACLK Next Generation])
754
- if test "${have_CXX_compiler}" != "yes"; then
755
- AC_MSG_RESULT([no])
756
- can_enable_ng="no"
757
- else
758
- AC_MSG_RESULT([yes])
759
- fi
760
-
761
- if test "${with_bundled_protobuf}" = "yes"; then
762
- AC_LANG_PUSH([C++])
763
- CXXFLAGS="${CXXFLAGS} -std=c++11"
764
-
765
- # On some platforms, std::atomic needs a helper library
766
- AC_MSG_CHECKING(whether -latomic is needed for static protobuf)
767
- AC_LINK_IFELSE([AC_LANG_SOURCE([[
768
- #include <atomic>
769
- #include <cstdint>
770
- std::atomic<std::int64_t> v;
771
- int main() {
772
- return v;
773
- }
774
- ]])], STD_ATOMIC_NEED_LIBATOMIC=no, STD_ATOMIC_NEED_LIBATOMIC=yes)
775
- AC_MSG_RESULT($STD_ATOMIC_NEED_LIBATOMIC)
776
- if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then
777
- OPTIONAL_ATOMIC_LIBS="-latomic"
778
- fi
779
- AC_SUBST([OPTIONAL_ATOMIC_LIBS])
780
- AC_LANG_POP([C++])
781
- fi
747
748
AC_MSG_CHECKING([ACLK Next Generation can be built])
749
AC_MSG_RESULT([${can_enable_ng}])
@@ -790,10 +755,67 @@ if test "$enable_cloud" != "no" -a "$aclk_ng" != "no"; then
755
enable_aclk="yes"
756
AC_DEFINE([ACLK_NG], [1], [ACLK Next Generation Should be used])
757
AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK])
793
- OPTIONAL_ACLK_NG_CFLAGS="-I \$(abs_top_srcdir)/mqtt_websockets/src/include -I \$(abs_top_srcdir)/mqtt_websockets/c-rbuf/include -I \$(abs_top_srcdir)/mqtt_websockets/MQTT-C/include -I \$(abs_top_srcdir)/aclk/aclk-schemas"
794
- OPTIONAL_PROTOBUF_CFLAGS="${PROTOBUF_CFLAGS}"
795
- CXX11FLAG="-std=c++11"
796
- OPTIONAL_PROTOBUF_LIBS="${PROTOBUF_LIBS}"
758
+ OPTIONAL_ACLK_NG_CFLAGS="-I \$(abs_top_srcdir)/mqtt_websockets/src/include -I \$(abs_top_srcdir)/mqtt_websockets/c-rbuf/include -I \$(abs_top_srcdir)/mqtt_websockets/MQTT-C/include"
759
+ fi
760
+
761
+ if test "$aclk_ng" = "yes" -a "$new_cloud_protocol" != "no"; then
762
+ can_build_new_cloud_protocol="yes"
763
+ AC_MSG_CHECKING([if protobuf available for New Cloud Protocol])
764
+ if test "${have_libprotobuf}" != "yes"; then
765
+ AC_MSG_RESULT([no])
766
+ can_build_new_cloud_protocol="no"
767
+ else
768
+ AC_MSG_RESULT([yes])
769
+ fi
770
+ AC_MSG_CHECKING([if protoc available for New Cloud Protocol])
771
+ if test "${have_protoc}" != "yes"; then
772
+ AC_MSG_RESULT([no])
773
+ can_build_new_cloud_protocol="no"
774
+ else
775
+ AC_MSG_RESULT([yes])
776
+ fi
777
+ AC_MSG_CHECKING([if C++ compiler available for New Cloud Protocol])
778
+ if test "${have_CXX_compiler}" != "yes"; then
779
+ AC_MSG_RESULT([no])
780
+ can_build_new_cloud_protocol="no"
781
+ else
782
+ AC_MSG_RESULT([yes])
783
+ fi
784
+
785
+ if test "${with_bundled_protobuf}" = "yes"; then
786
+ AC_LANG_PUSH([C++])
787
+ CXXFLAGS="${CXXFLAGS} -std=c++11"
788
+
789
+ # On some platforms, std::atomic needs a helper library
790
+ AC_MSG_CHECKING(whether -latomic is needed for static protobuf)
791
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
792
+ #include <atomic>
793
+ #include <cstdint>
794
+ std::atomic<std::int64_t> v;
795
+ int main() {
796
+ return v;
797
+ }
798
+ ]])], STD_ATOMIC_NEED_LIBATOMIC=no, STD_ATOMIC_NEED_LIBATOMIC=yes)
799
+ AC_MSG_RESULT($STD_ATOMIC_NEED_LIBATOMIC)
800
+ if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then
801
+ OPTIONAL_ATOMIC_LIBS="-latomic"
802
+ fi
803
+ AC_SUBST([OPTIONAL_ATOMIC_LIBS])
804
+ AC_LANG_POP([C++])
805
+ fi
806
+ AC_MSG_CHECKING([ACLK Next Generation can support New Cloud protocol])
807
+ AC_MSG_RESULT([${can_build_new_cloud_protocol}])
808
+ if test "$new_cloud_protocol" = "yes" -a "$can_build_new_cloud_protocol" != "yes"; then
809
+ AC_MSG_ERROR([Requested new cloud protocol support but it cant be build])
810
+ fi
811
+ if test "$can_build_new_cloud_protocol" = "yes"; then
812
+ new_cloud_protocol="yes"
813
+ AC_DEFINE([ENABLE_NEW_CLOUD_PROTOCOL], [1], [New protobuf based Netdata Cloud Protocol Support])
814
+ OPTIONAL_ACLK_NG_CFLAGS="${OPTIONAL_ACLK_NG_CFLAGS} -I \$(abs_top_srcdir)/aclk/aclk-schemas"
815
+ OPTIONAL_PROTOBUF_CFLAGS="${PROTOBUF_CFLAGS}"
816
+ CXX11FLAG="-std=c++11"
817
+ OPTIONAL_PROTOBUF_LIBS="${PROTOBUF_LIBS}"
818
+ fi
819
fi
820
fi
821
@@ -888,6 +910,7 @@ AC_SUBST([enable_aclk])
910
AM_CONDITIONAL([ACLK_NG], [test "${aclk_ng}" = "yes"])
911
AM_CONDITIONAL([ACLK_LEGACY], [test "${aclk_legacy}" = "yes"])
912
AM_CONDITIONAL([ENABLE_ACLK], [test "${enable_aclk}" = "yes"])
913
+AM_CONDITIONAL([ENABLE_NEW_CLOUD_PROTOCOL], [test "${can_build_new_cloud_protocol}" = "yes"])
914
915
# -----------------------------------------------------------------------------
916
# apps.plugin
@@ -1534,7 +1557,7 @@ AC_MSG_RESULT([${enable_lto}])
1557
AM_CONDITIONAL([ENABLE_CXX_LINKER], [test "${enable_backend_kinesis}" = "yes" \
1558
-o "${enable_exporting_pubsub}" = "yes" \
1559
-o "${enable_backend_prometheus_remote_write}" = "yes" \
1537
- -o "${aclk_ng}" = "yes"])
1560
+ -o "${new_cloud_protocol}" = "yes"])
1561
1562
AC_DEFINE_UNQUOTED([NETDATA_USER], ["${with_user}"], [use this user to drop privileged])
1563
daemon/buildinfo.c
+17
-8
@@ -199,6 +199,12 @@
199
#define FEAT_ACLK_NG 0
200
#endif
201
202
+#if defined(ACLK_NG) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
203
+#define NEW_CLOUD_PROTO 1
204
+#else
205
+#define NEW_CLOUD_PROTO 0
206
+#endif
207
+
208
#ifdef ACLK_LEGACY
209
#define FEAT_ACLK_LEGACY 1
210
#else
@@ -211,12 +217,13 @@ void print_build_info(void) {
217
printf("Configure options: %s\n", CONFIGURE_COMMAND);
218
219
printf("Features:\n");
214
- printf(" dbengine: %s\n", FEAT_YES_NO(FEAT_DBENGINE));
215
- printf(" Native HTTPS: %s\n", FEAT_YES_NO(FEAT_NATIVE_HTTPS));
216
- printf(" Netdata Cloud: %s %s\n", FEAT_YES_NO(FEAT_CLOUD), FEAT_CLOUD_MSG);
217
- printf(" ACLK Next Generation: %s\n", FEAT_YES_NO(FEAT_ACLK_NG));
218
- printf(" ACLK Legacy: %s\n", FEAT_YES_NO(FEAT_ACLK_LEGACY));
219
- printf(" TLS Host Verification: %s\n", FEAT_YES_NO(FEAT_TLS_HOST_VERIFY));
220
+ printf(" dbengine: %s\n", FEAT_YES_NO(FEAT_DBENGINE));
221
+ printf(" Native HTTPS: %s\n", FEAT_YES_NO(FEAT_NATIVE_HTTPS));
222
+ printf(" Netdata Cloud: %s %s\n", FEAT_YES_NO(FEAT_CLOUD), FEAT_CLOUD_MSG);
223
+ printf(" ACLK Next Generation: %s\n", FEAT_YES_NO(FEAT_ACLK_NG));
224
+ printf(" ACLK-NG New Cloud Protocol: %s\n", FEAT_YES_NO(NEW_CLOUD_PROTO));
225
+ printf(" ACLK Legacy: %s\n", FEAT_YES_NO(FEAT_ACLK_LEGACY));
226
+ printf(" TLS Host Verification: %s\n", FEAT_YES_NO(FEAT_TLS_HOST_VERIFY));
227
228
printf("Libraries:\n");
229
printf(" jemalloc: %s\n", FEAT_YES_NO(FEAT_JEMALLOC));
@@ -271,8 +278,9 @@ void print_build_info_json(void) {
278
#else
279
printf(" \"cloud-disabled\": false,\n");
280
#endif
274
- printf(" \"aclk-ng\": \"%s\",\n", FEAT_JSON_BOOL(FEAT_ACLK_NG));
275
- printf(" \"aclk-legacy\": \"%s\",\n", FEAT_JSON_BOOL(FEAT_ACLK_LEGACY));
281
+ printf(" \"aclk-ng\": %s,\n", FEAT_JSON_BOOL(FEAT_ACLK_NG));
282
+ printf(" \"aclk-ng-new-cloud-proto\": %s,\n", FEAT_JSON_BOOL(NEW_CLOUD_PROTO));
283
+ printf(" \"aclk-legacy\": %s,\n", FEAT_JSON_BOOL(FEAT_ACLK_LEGACY));
284
285
printf(" \"tls-host-verify\": %s\n", FEAT_JSON_BOOL(FEAT_TLS_HOST_VERIFY));
286
printf(" },\n");
@@ -326,6 +334,7 @@ void analytics_build_info(BUFFER *b) {
334
if(FEAT_NATIVE_HTTPS) buffer_strcat (b, "|Native HTTPS");
335
if(FEAT_CLOUD) buffer_strcat (b, "|Netdata Cloud");
336
if(FEAT_ACLK_NG) buffer_strcat (b, "|ACLK Next Generation");
337
+ if(NEW_CLOUD_PROTO) buffer_strcat (b, "|New Cloud Protocol Support");
338
if(FEAT_ACLK_LEGACY) buffer_strcat (b, "|ACLK Legacy");
339
if(FEAT_TLS_HOST_VERIFY) buffer_strcat (b, "|TLS Host Verification");
340
database/sqlite/sqlite_aclk_alert.c
+4
-4
@@ -102,7 +102,7 @@ int rrdcalc_status_to_proto_enum(RRDCALC_STATUS status)
102
103
void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd)
104
{
105
-#ifndef ACLK_NG
105
+#ifndef ENABLE_NEW_CLOUD_PROTOCOL
106
UNUSED(wc);
107
UNUSED(cmd);
108
#else
@@ -259,7 +259,7 @@ void aclk_send_alarm_health_log(char *node_id)
259
void aclk_push_alarm_health_log(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd)
260
{
261
UNUSED(cmd);
262
-#ifndef ACLK_NG
262
+#ifndef ENABLE_NEW_CLOUD_PROTOCOL
263
UNUSED(wc);
264
#else
265
int rc;
@@ -362,7 +362,7 @@ void aclk_send_alarm_configuration(char *config_hash)
362
int aclk_push_alert_config_event(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd)
363
{
364
UNUSED(wc);
365
-#ifndef ACLK_NG
365
+#ifndef ENABLE_NEW_CLOUD_PROTOCOL
366
UNUSED(cmd);
367
#else
368
int rc = 0;
@@ -482,7 +482,7 @@ int aclk_push_alert_config_event(struct aclk_database_worker_config *wc, struct
482
// Start streaming alerts
483
void aclk_start_alert_streaming(char *node_id, uint64_t batch_id, uint64_t start_seq_id)
484
{
485
-#ifdef ACLK_NG
485
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
486
if (unlikely(!node_id))
487
return;
488
database/sqlite/sqlite_aclk_chart.c
+6
-6
@@ -123,7 +123,7 @@ int aclk_add_chart_event(struct aclk_database_worker_config *wc, struct aclk_dat
123
int rc = 0;
124
CHECK_SQLITE_CONNECTION(db_meta);
125
126
-#ifdef ACLK_NG
126
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
127
char *claim_id = is_agent_claimed();
128
129
RRDSET *st = cmd.data;
@@ -169,7 +169,7 @@ int aclk_add_dimension_event(struct aclk_database_worker_config *wc, struct aclk
169
int rc = 0;
170
CHECK_SQLITE_CONNECTION(db_meta);
171
172
-#ifdef ACLK_NG
172
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
173
char *claim_id = is_agent_claimed();
174
175
RRDDIM *rd = cmd.data;
@@ -216,7 +216,7 @@ int aclk_add_dimension_event(struct aclk_database_worker_config *wc, struct aclk
216
217
void aclk_send_chart_event(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd)
218
{
219
-#ifdef ACLK_NG
219
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
220
int rc;
221
222
wc->chart_pending = 0;
@@ -351,7 +351,7 @@ bind_fail:
351
int aclk_send_chart_config(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd)
352
{
353
UNUSED(wc);
354
-#ifdef ACLK_NG
354
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
355
356
CHECK_SQLITE_CONNECTION(db_meta);
357
@@ -470,7 +470,7 @@ void aclk_receive_chart_reset(struct aclk_database_worker_config *wc, struct acl
470
wc->chart_sequence_id = 0;
471
wc->chart_timestamp = 0;
472
473
-#ifdef ACLK_NG
473
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
474
RRDHOST *host = wc->host;
475
rrdhost_rdlock(host);
476
RRDSET *st;
@@ -674,7 +674,7 @@ fail:
674
// Start streaming charts / dimensions for node_id
675
void aclk_start_streaming(char *node_id, uint64_t sequence_id, time_t created_at, uint64_t batch_id)
676
{
677
-#ifdef ACLK_NG
677
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
678
if (unlikely(!node_id))
679
return;
680
database/sqlite/sqlite_aclk_node.c
+2
-2
@@ -3,7 +3,7 @@
3
#include "sqlite_functions.h"
4
#include "sqlite_aclk_node.h"
5
6
-#ifdef ACLK_NG
6
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
7
#include "../../aclk/aclk_charts_api.h"
8
#endif
9
@@ -11,7 +11,7 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat
11
{
12
UNUSED(cmd);
13
14
-#ifdef ACLK_NG
14
+#ifdef ENABLE_NEW_CLOUD_PROTOCOL
15
struct update_node_info node_info;
16
17
rrd_wrlock();
web/api/web_api_v1.c
+5
@@ -984,6 +984,11 @@ inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb)
984
#else
985
buffer_strcat(wb, "\t\"aclk-ng-available\": false,\n");
986
#endif
987
+#if defined(ACLK_NG) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
988
+ buffer_strcat(wb, "\t\"aclk-ng-new-cloud-protocol\": true,\n");
989
+#else
990
+ buffer_strcat(wb, "\t\"aclk-ng-new-cloud-protocol\": false,\n");
991
+#endif
992
#ifdef ACLK_LEGACY
993
buffer_strcat(wb, "\t\"aclk-legacy-available\": true,\n");
994
#else