diff options
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/analytics.c | 89 | ||||
-rw-r--r-- | daemon/analytics.h | 15 | ||||
-rwxr-xr-x | daemon/anonymous-statistics.sh.in | 20 | ||||
-rw-r--r-- | daemon/buildinfo.c | 153 | ||||
-rw-r--r-- | daemon/buildinfo.h | 10 | ||||
-rw-r--r-- | daemon/commands.c | 11 | ||||
-rw-r--r-- | daemon/common.h | 2 | ||||
-rw-r--r-- | daemon/global_statistics.c | 2 | ||||
-rw-r--r-- | daemon/global_statistics.h | 12 | ||||
-rw-r--r-- | daemon/main.c | 41 | ||||
-rw-r--r-- | daemon/main.h | 18 | ||||
-rw-r--r-- | daemon/service.c | 2 | ||||
-rw-r--r-- | daemon/service.h | 19 | ||||
-rw-r--r-- | daemon/static_threads.c | 161 | ||||
-rw-r--r-- | daemon/static_threads.h | 46 | ||||
-rw-r--r-- | daemon/static_threads_freebsd.c | 31 | ||||
-rw-r--r-- | daemon/static_threads_linux.c | 71 | ||||
-rw-r--r-- | daemon/static_threads_macos.c | 31 | ||||
-rwxr-xr-x | daemon/system-info.sh | 2 | ||||
-rw-r--r-- | daemon/unit_test.c | 22 |
20 files changed, 507 insertions, 251 deletions
diff --git a/daemon/analytics.c b/daemon/analytics.c index bb878f708..4501a46a5 100644 --- a/daemon/analytics.c +++ b/daemon/analytics.c @@ -1,12 +1,13 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "common.h" +#include "buildinfo.h" struct analytics_data analytics_data; extern void analytics_exporting_connectors (BUFFER *b); extern void analytics_exporting_connectors_ssl (BUFFER *b); extern void analytics_build_info (BUFFER *b); -extern int aclk_connected; +extern int aclk_connected, aclk_use_new_cloud_arch; struct collector { char *plugin; @@ -52,6 +53,7 @@ void analytics_log_data(void) debug(D_ANALYTICS, "NETDATA_CONFIG_HOSTS_AVAILABLE : [%s]", analytics_data.netdata_config_hosts_available); debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_AVAILABLE : [%s]", analytics_data.netdata_host_cloud_available); debug(D_ANALYTICS, "NETDATA_HOST_ACLK_AVAILABLE : [%s]", analytics_data.netdata_host_aclk_available); + debug(D_ANALYTICS, "NETDATA_HOST_ACLK_PROTOCOL : [%s]", analytics_data.netdata_host_aclk_protocol); debug(D_ANALYTICS, "NETDATA_HOST_ACLK_IMPLEMENTATION : [%s]", analytics_data.netdata_host_aclk_implementation); debug(D_ANALYTICS, "NETDATA_HOST_AGENT_CLAIMED : [%s]", analytics_data.netdata_host_agent_claimed); debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_ENABLED : [%s]", analytics_data.netdata_host_cloud_enabled); @@ -97,6 +99,7 @@ void analytics_free_data(void) freez(analytics_data.netdata_config_hosts_available); freez(analytics_data.netdata_host_cloud_available); freez(analytics_data.netdata_host_aclk_available); + freez(analytics_data.netdata_host_aclk_protocol); freez(analytics_data.netdata_host_aclk_implementation); freez(analytics_data.netdata_host_agent_claimed); freez(analytics_data.netdata_host_cloud_enabled); @@ -357,47 +360,23 @@ void analytics_alarms_notifications(void) buffer_free(b); } -char *get_value_from_key(char *buffer, char *key) -{ - char *s = NULL, *t = NULL; - s = t = buffer + strlen(key) + 2; - if (s) { - while (*s == '\'') - s++; - while (*++t != '\0'); - while (--t > s && *t == '\'') - *t = '\0'; - } - return s; -} - -/* - * Checks for the existence of .install_type file and reads it - */ void analytics_get_install_type(void) { - char *install_type_filename; - analytics_set_data_str(&analytics_data.netdata_install_type, ""); - analytics_set_data_str(&analytics_data.netdata_prebuilt_distro, ""); + struct install_type_info t = get_install_type(); - int install_type_filename_len = (strlen(netdata_configured_user_config_dir) + strlen(".install-type") + 3); - install_type_filename = mallocz(sizeof(char) * install_type_filename_len); - snprintfz(install_type_filename, install_type_filename_len - 1, "%s/%s", netdata_configured_user_config_dir, ".install-type"); + if (t.install_type == NULL) { + analytics_set_data_str(&analytics_data.netdata_install_type, "unknown"); + } else { + analytics_set_data_str(&analytics_data.netdata_install_type, t.install_type); + } - FILE *fp = fopen(install_type_filename, "r"); - if (fp) { - char *s, buf[256 + 1]; - size_t len = 0; - - while ((s = fgets_trim_len(buf, 256, fp, &len))) { - if (!strncmp(buf, "INSTALL_TYPE='", 14)) - analytics_set_data_str(&analytics_data.netdata_install_type, (char *)get_value_from_key(buf, "INSTALL_TYPE")); - else if (!strncmp(buf, "PREBUILT_DISTRO='", 17)) - analytics_set_data_str(&analytics_data.netdata_prebuilt_distro, (char *)get_value_from_key(buf, "PREBUILT_DISTRO")); - } - fclose(fp); + if (t.prebuilt_distro != NULL) { + analytics_set_data_str(&analytics_data.netdata_prebuilt_distro, t.prebuilt_distro); } - freez(install_type_filename); + + freez(t.prebuilt_arch); + freez(t.prebuilt_distro); + freez(t.install_type); } /* @@ -488,28 +467,18 @@ void analytics_alarms(void) } /* - * Misc attributes to get (run from meta) + * Misc attributes to get (run from start) */ void analytics_misc(void) { #ifdef ENABLE_ACLK analytics_set_data(&analytics_data.netdata_host_cloud_available, "true"); - if (aclk_ng) - analytics_set_data_str(&analytics_data.netdata_host_aclk_implementation, "Next Generation"); - else - analytics_set_data_str(&analytics_data.netdata_host_aclk_implementation, "legacy"); + analytics_set_data_str(&analytics_data.netdata_host_aclk_implementation, "Next Generation"); #else analytics_set_data(&analytics_data.netdata_host_cloud_available, "false"); analytics_set_data_str(&analytics_data.netdata_host_aclk_implementation, ""); #endif -#ifdef ENABLE_ACLK - if (aclk_connected) - analytics_set_data(&analytics_data.netdata_host_aclk_available, "true"); - else -#endif - analytics_set_data(&analytics_data.netdata_host_aclk_available, "false"); - analytics_set_data(&analytics_data.netdata_config_exporting_enabled, appconfig_get_boolean(&exporting_config, CONFIG_SECTION_EXPORTING, "enabled", CONFIG_BOOLEAN_NO) ? "true" : "false"); analytics_set_data(&analytics_data.netdata_config_is_private_registry, "false"); @@ -526,6 +495,23 @@ void analytics_misc(void) analytics_set_data(&analytics_data.netdata_config_is_private_registry, "true"); } +void analytics_aclk(void) +{ +#ifdef ENABLE_ACLK + if (aclk_connected) { + analytics_set_data(&analytics_data.netdata_host_aclk_available, "true"); +#ifdef ENABLE_NEW_CLOUD_PROTOCOL + if (aclk_use_new_cloud_arch) + analytics_set_data_str(&analytics_data.netdata_host_aclk_protocol, "New"); + else +#endif + analytics_set_data_str(&analytics_data.netdata_host_aclk_protocol, "Legacy"); + } + else +#endif + analytics_set_data(&analytics_data.netdata_host_aclk_available, "false"); +} + /* * Get the meta data, called from the thread once after the original delay * These are values that won't change during agent runtime, and therefore @@ -551,6 +537,7 @@ void analytics_gather_mutable_meta_data(void) analytics_alarms(); analytics_charts(); analytics_metrics(); + analytics_aclk(); rrdhost_unlock(localhost); @@ -892,6 +879,7 @@ void set_global_environment() analytics_set_data(&analytics_data.netdata_host_cloud_available, "null"); analytics_set_data(&analytics_data.netdata_host_aclk_implementation, "null"); analytics_set_data(&analytics_data.netdata_host_aclk_available, "null"); + analytics_set_data(&analytics_data.netdata_host_aclk_protocol, "null"); analytics_set_data(&analytics_data.netdata_host_agent_claimed, "null"); analytics_set_data(&analytics_data.netdata_host_cloud_enabled, "null"); analytics_set_data(&analytics_data.netdata_config_https_available, "null"); @@ -979,7 +967,7 @@ void send_statistics(const char *action, const char *action_result, const char * sprintf( command_to_run, - "%s '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' ", + "%s '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' ", as_script, action, action_result, @@ -1013,6 +1001,7 @@ void send_statistics(const char *action, const char *action_result, const char * analytics_data.netdata_config_hosts_available, analytics_data.netdata_host_cloud_available, analytics_data.netdata_host_aclk_available, + analytics_data.netdata_host_aclk_protocol, analytics_data.netdata_host_aclk_implementation, analytics_data.netdata_host_agent_claimed, analytics_data.netdata_host_cloud_enabled, diff --git a/daemon/analytics.h b/daemon/analytics.h index 78ced981e..76c1cbb7e 100644 --- a/daemon/analytics.h +++ b/daemon/analytics.h @@ -17,19 +17,8 @@ #define ANALYTICS_MAX_JSON_HITS 255 #define ANALYTICS_MAX_DASHBOARD_HITS 255 -#define NETDATA_PLUGIN_HOOK_ANALYTICS \ - { \ - .name = "ANALYTICS", \ - .config_section = NULL, \ - .config_name = NULL, \ - .enabled = 0, \ - .thread = NULL, \ - .init_routine = NULL, \ - .start_routine = analytics_main \ - }, - /* Needed to calculate the space needed for parameters */ -#define ANALYTICS_NO_OF_ITEMS 38 +#define ANALYTICS_NO_OF_ITEMS 39 struct analytics_data { char *netdata_config_stream_enabled; @@ -61,6 +50,7 @@ struct analytics_data { char *netdata_config_hosts_available; char *netdata_host_cloud_available; char *netdata_host_aclk_available; + char *netdata_host_aclk_protocol; char *netdata_host_aclk_implementation; char *netdata_host_agent_claimed; char *netdata_host_cloud_enabled; @@ -79,7 +69,6 @@ struct analytics_data { uint8_t dashboard_hits; }; -extern void *analytics_main(void *ptr); extern void analytics_get_data(char *name, BUFFER *wb); extern void set_late_global_environment(void); extern void analytics_free_data(void); diff --git a/daemon/anonymous-statistics.sh.in b/daemon/anonymous-statistics.sh.in index f49d19d09..9167b7062 100755 --- a/daemon/anonymous-statistics.sh.in +++ b/daemon/anonymous-statistics.sh.in @@ -54,15 +54,16 @@ NETDATA_CONFIG_IS_PARENT="${29}" NETDATA_CONFIG_HOSTS_AVAILABLE="${30}" NETDATA_HOST_CLOUD_AVAILABLE="${31}" NETDATA_HOST_ACLK_AVAILABLE="${32}" -NETDATA_HOST_ACLK_IMPLEMENTATION="${33}" -NETDATA_HOST_AGENT_CLAIMED="${34}" -NETDATA_HOST_CLOUD_ENABLED="${35}" -NETDATA_CONFIG_HTTPS_AVAILABLE="${36}" -NETDATA_INSTALL_TYPE="${37}" -NETDATA_IS_PRIVATE_REGISTRY="${38}" -NETDATA_USE_PRIVATE_REGISTRY="${39}" -NETDATA_CONFIG_OOM_SCORE="${40}" -NETDATA_PREBUILT_DISTRO="${41}" +NETDATA_HOST_ACLK_PROTOCOL="${33}" +NETDATA_HOST_ACLK_IMPLEMENTATION="${34}" +NETDATA_HOST_AGENT_CLAIMED="${35}" +NETDATA_HOST_CLOUD_ENABLED="${36}" +NETDATA_CONFIG_HTTPS_AVAILABLE="${37}" +NETDATA_INSTALL_TYPE="${38}" +NETDATA_IS_PRIVATE_REGISTRY="${39}" +NETDATA_USE_PRIVATE_REGISTRY="${40}" +NETDATA_CONFIG_OOM_SCORE="${41}" +NETDATA_PREBUILT_DISTRO="${42}" # define body of request to be sent @@ -147,6 +148,7 @@ REQ_BODY="$(cat << EOF "host_cloud_enabled": ${NETDATA_HOST_CLOUD_ENABLED}, "host_agent_claimed": ${NETDATA_HOST_AGENT_CLAIMED}, "host_aclk_available": ${NETDATA_HOST_ACLK_AVAILABLE}, + "host_aclk_protocol": ${NETDATA_HOST_ACLK_PROTOCOL}, "host_aclk_implementation": ${NETDATA_HOST_ACLK_IMPLEMENTATION}, "mirrored_host_count": ${NETDATA_MIRRORED_HOST_COUNT}, "mirrored_hosts_reachable": ${NETDATA_MIRRORED_HOSTS_REACHABLE}, diff --git a/daemon/buildinfo.c b/daemon/buildinfo.c index a15250f48..b64a78f29 100644 --- a/daemon/buildinfo.c +++ b/daemon/buildinfo.c @@ -3,6 +3,7 @@ #include <stdio.h> #include "./config.h" #include "common.h" +#include "buildinfo.h" // Optional features @@ -19,24 +20,12 @@ #endif #endif -#ifdef ACLK_NG -#define FEAT_ACLK_NG 1 -#else -#define FEAT_ACLK_NG 0 -#endif - -#if defined(ACLK_NG) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_NEW_CLOUD_PROTOCOL #define NEW_CLOUD_PROTO 1 #else #define NEW_CLOUD_PROTO 0 #endif -#ifdef ACLK_LEGACY -#define FEAT_ACLK_LEGACY 1 -#else -#define FEAT_ACLK_LEGACY 0 -#endif - #ifdef ENABLE_DBENGINE #define FEAT_DBENGINE 1 #else @@ -61,6 +50,13 @@ #define FEAT_ML 0 #endif +#ifdef ENABLE_COMPRESSION +#define FEAT_STREAM_COMPRESSION 1 +#else +#define FEAT_STREAM_COMPRESSION 0 +#endif //ENABLE_COMPRESSION + + // Optional libraries #ifdef HAVE_PROTOBUF @@ -104,30 +100,6 @@ #define FEAT_LIBCAP 0 #endif -#ifndef ACLK_LEGACY_DISABLED - #ifdef ACLK_NO_LIBMOSQ - #define FEAT_MOSQUITTO 0 - #else - #define FEAT_MOSQUITTO 1 - #endif - - #ifdef ACLK_NO_LWS - #define FEAT_LWS 0 - #define FEAT_LWS_MSG "" - #else - #ifdef ACLK_LEGACY - #include <libwebsockets.h> - #endif - #ifdef BUNDLED_LWS - #define FEAT_LWS 1 - #define FEAT_LWS_MSG "static" - #else - #define FEAT_LWS 1 - #define FEAT_LWS_MSG "shared-lib" - #endif - #endif -#endif /* ACLK_LEGACY_DISABLED */ - #ifdef NETDATA_WITH_ZLIB #define FEAT_ZLIB 1 #else @@ -236,18 +208,81 @@ #define FEAT_YES_NO(x) ((x) ? "YES" : "NO") + +char *get_value_from_key(char *buffer, char *key) { + char *s = NULL, *t = NULL; + s = t = buffer + strlen(key) + 2; + if (s) { + while (*s == '\'') + s++; + while (*++t != '\0'); + while (--t > s && *t == '\'') + *t = '\0'; + } + return s; +} + +struct install_type_info get_install_type() { + char *install_type_filename; + struct install_type_info ret = {.install_type = NULL, .prebuilt_arch = NULL, .prebuilt_distro = NULL}; + + int install_type_filename_len = (strlen(netdata_configured_user_config_dir) + strlen(".install-type") + 3); + install_type_filename = mallocz(sizeof(char) * install_type_filename_len); + snprintfz(install_type_filename, install_type_filename_len - 1, "%s/%s", netdata_configured_user_config_dir, ".install-type"); + + FILE *fp = fopen(install_type_filename, "r"); + if (fp) { + char *s, buf[256 + 1]; + size_t len = 0; + + while ((s = fgets_trim_len(buf, 256, fp, &len))) { + if (!strncmp(buf, "INSTALL_TYPE='", 14)) + ret.install_type = strdupz((char *)get_value_from_key(buf, "INSTALL_TYPE")); + else if (!strncmp(buf, "PREBUILT_ARCH='", 15)) + ret.prebuilt_arch = strdupz((char *)get_value_from_key(buf, "PREBUILT_ARCH")); + else if (!strncmp(buf, "PREBUILT_DISTRO='", 17)) + ret.prebuilt_distro = strdupz((char *)get_value_from_key(buf, "PREBUILT_DISTRO")); + } + fclose(fp); + } + freez(install_type_filename); + + return ret; +} + void print_build_info(void) { + struct install_type_info t = get_install_type(); + printf("Configure options: %s\n", CONFIGURE_COMMAND); + if (t.install_type == NULL) { + printf("Install type: unknown\n"); + } else { + printf("Install type: %s\n", t.install_type); + } + + if (t.prebuilt_arch != NULL) { + printf(" Binary architecture: %s\n", t.prebuilt_arch); + } + + if (t.prebuilt_distro != NULL) { + printf(" Packaging distro: %s\n", t.prebuilt_distro); + } + + freez(t.install_type); + freez(t.prebuilt_arch); + freez(t.prebuilt_distro); + printf("Features:\n"); printf(" dbengine: %s\n", FEAT_YES_NO(FEAT_DBENGINE)); printf(" Native HTTPS: %s\n", FEAT_YES_NO(FEAT_NATIVE_HTTPS)); printf(" Netdata Cloud: %s %s\n", FEAT_YES_NO(FEAT_CLOUD), FEAT_CLOUD_MSG); - printf(" ACLK Next Generation: %s\n", FEAT_YES_NO(FEAT_ACLK_NG)); + printf(" ACLK Next Generation: %s\n", FEAT_YES_NO(FEAT_CLOUD)); printf(" ACLK-NG New Cloud Protocol: %s\n", FEAT_YES_NO(NEW_CLOUD_PROTO)); - printf(" ACLK Legacy: %s\n", FEAT_YES_NO(FEAT_ACLK_LEGACY)); + printf(" ACLK Legacy: %s\n", FEAT_YES_NO(0)); printf(" TLS Host Verification: %s\n", FEAT_YES_NO(FEAT_TLS_HOST_VERIFY)); printf(" Machine Learning: %s\n", FEAT_YES_NO(FEAT_ML)); + printf(" Stream Compression: %s\n", FEAT_YES_NO(FEAT_STREAM_COMPRESSION)); printf("Libraries:\n"); printf(" protobuf: %s%s\n", FEAT_YES_NO(FEAT_PROTOBUF), FEAT_PROTOBUF_BUNDLED); @@ -256,14 +291,6 @@ void print_build_info(void) { printf(" libcap: %s\n", FEAT_YES_NO(FEAT_LIBCAP)); printf(" libcrypto: %s\n", FEAT_YES_NO(FEAT_CRYPTO)); printf(" libm: %s\n", FEAT_YES_NO(FEAT_LIBM)); -#ifndef ACLK_LEGACY_DISABLED -#if defined(ACLK_LEGACY) - printf(" LWS: %s %s v%d.%d.%d\n", FEAT_YES_NO(FEAT_LWS), FEAT_LWS_MSG, LWS_LIBRARY_VERSION_MAJOR, LWS_LIBRARY_VERSION_MINOR, LWS_LIBRARY_VERSION_PATCH); -#else - printf(" LWS: %s %s\n", FEAT_YES_NO(FEAT_LWS), FEAT_LWS_MSG); -#endif - printf(" mosquitto: %s\n", FEAT_YES_NO(FEAT_MOSQUITTO)); -#endif printf(" tcalloc: %s\n", FEAT_YES_NO(FEAT_TCMALLOC)); printf(" zlib: %s\n", FEAT_YES_NO(FEAT_ZLIB)); @@ -286,7 +313,6 @@ void print_build_info(void) { printf(" Prometheus Remote Write: %s\n", FEAT_YES_NO(FEAT_REMOTE_WRITE)); }; - #define FEAT_JSON_BOOL(x) ((x) ? "true" : "false") // This intentionally does not use JSON-C so it works even if JSON-C is not present // This is used for anonymous statistics reporting, so it intentionally @@ -303,12 +329,13 @@ void print_build_info_json(void) { #else printf(" \"cloud-disabled\": false,\n"); #endif - printf(" \"aclk-ng\": %s,\n", FEAT_JSON_BOOL(FEAT_ACLK_NG)); + printf(" \"aclk-ng\": %s,\n", FEAT_JSON_BOOL(FEAT_CLOUD)); printf(" \"aclk-ng-new-cloud-proto\": %s,\n", FEAT_JSON_BOOL(NEW_CLOUD_PROTO)); - printf(" \"aclk-legacy\": %s,\n", FEAT_JSON_BOOL(FEAT_ACLK_LEGACY)); + printf(" \"aclk-legacy\": %s,\n", FEAT_JSON_BOOL(0)); printf(" \"tls-host-verify\": %s,\n", FEAT_JSON_BOOL(FEAT_TLS_HOST_VERIFY)); printf(" \"machine-learning\": %s\n", FEAT_JSON_BOOL(FEAT_ML)); + printf(" \"stream-compression\": %s\n", FEAT_JSON_BOOL(FEAT_STREAM_COMPRESSION)); printf(" },\n"); printf(" \"libs\": {\n"); @@ -319,16 +346,6 @@ void print_build_info_json(void) { printf(" \"libcap\": %s,\n", FEAT_JSON_BOOL(FEAT_LIBCAP)); printf(" \"libcrypto\": %s,\n", FEAT_JSON_BOOL(FEAT_CRYPTO)); printf(" \"libm\": %s,\n", FEAT_JSON_BOOL(FEAT_LIBM)); -#ifndef ACLK_NG -#if defined(ENABLE_ACLK) - printf(" \"lws\": %s,\n", FEAT_JSON_BOOL(FEAT_LWS)); - printf(" \"lws-version\": \"%d.%d.%d\",\n", LWS_LIBRARY_VERSION_MAJOR, LWS_LIBRARY_VERSION_MINOR, LWS_LIBRARY_VERSION_PATCH); - printf(" \"lws-type\": \"%s\",\n", FEAT_LWS_MSG); -#else - printf(" \"lws\": %s,\n", FEAT_JSON_BOOL(FEAT_LWS)); -#endif - printf(" \"mosquitto\": %s,\n", FEAT_JSON_BOOL(FEAT_MOSQUITTO)); -#endif printf(" \"tcmalloc\": %s,\n", FEAT_JSON_BOOL(FEAT_TCMALLOC)); printf(" \"zlib\": %s\n", FEAT_JSON_BOOL(FEAT_ZLIB)); printf(" },\n"); @@ -361,11 +378,11 @@ void analytics_build_info(BUFFER *b) { if(FEAT_DBENGINE) buffer_strcat (b, "dbengine"); if(FEAT_NATIVE_HTTPS) buffer_strcat (b, "|Native HTTPS"); if(FEAT_CLOUD) buffer_strcat (b, "|Netdata Cloud"); - if(FEAT_ACLK_NG) buffer_strcat (b, "|ACLK Next Generation"); + if(FEAT_CLOUD) buffer_strcat (b, "|ACLK Next Generation"); if(NEW_CLOUD_PROTO) buffer_strcat (b, "|New Cloud Protocol Support"); - if(FEAT_ACLK_LEGACY) buffer_strcat (b, "|ACLK Legacy"); if(FEAT_TLS_HOST_VERIFY) buffer_strcat (b, "|TLS Host Verification"); if(FEAT_ML) buffer_strcat (b, "|Machine Learning"); + if(FEAT_STREAM_COMPRESSION) buffer_strcat (b, "|Stream Compression"); if(FEAT_PROTOBUF) buffer_strcat (b, "|protobuf"); if(FEAT_JEMALLOC) buffer_strcat (b, "|jemalloc"); @@ -374,18 +391,6 @@ void analytics_build_info(BUFFER *b) { if(FEAT_CRYPTO) buffer_strcat (b, "|libcrypto"); if(FEAT_LIBM) buffer_strcat (b, "|libm"); -#ifndef ACLK_LEGACY_DISABLED -#if defined(ENABLE_ACLK) && defined(ACLK_LEGACY) - { - char buf[20]; - snprintfz(buf, 19, "|LWS v%d.%d.%d", LWS_LIBRARY_VERSION_MAJOR, LWS_LIBRARY_VERSION_MINOR, LWS_LIBRARY_VERSION_PATCH); - if(FEAT_LWS) buffer_strcat(b, buf); - } -#else - if(FEAT_LWS) buffer_strcat(b, "|LWS"); -#endif - if(FEAT_MOSQUITTO) buffer_strcat(b, "|mosquitto"); -#endif if(FEAT_TCMALLOC) buffer_strcat(b, "|tcalloc"); if(FEAT_ZLIB) buffer_strcat(b, "|zlib"); diff --git a/daemon/buildinfo.h b/daemon/buildinfo.h index 05e5efb5a..e2a31c94a 100644 --- a/daemon/buildinfo.h +++ b/daemon/buildinfo.h @@ -3,8 +3,18 @@ #ifndef NETDATA_BUILDINFO_H #define NETDATA_BUILDINFO_H 1 +struct install_type_info { + char *install_type; + char *prebuilt_arch; + char *prebuilt_distro; +}; + extern void print_build_info(void); extern void print_build_info_json(void); +extern char *get_value_from_key(char *buffer, char *key); + +extern struct install_type_info get_install_type(); + #endif // NETDATA_BUILDINFO_H diff --git a/daemon/commands.c b/daemon/commands.c index 18468183f..ddf20fe0b 100644 --- a/daemon/commands.c +++ b/daemon/commands.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "common.h" -#include "database/engine/rrdenginelib.h" static uv_thread_t thread; static uv_loop_t* loop; @@ -640,7 +639,7 @@ static void command_thread(void *arg) command_thread_error = 0; command_thread_shutdown = 0; /* wake up initialization thread */ - complete(&completion); + completion_mark_complete(&completion); while (command_thread_shutdown == 0) { uv_run(loop, UV_RUN_DEFAULT); @@ -669,7 +668,7 @@ error_after_loop_init: freez(loop); /* wake up initialization thread */ - complete(&completion); + completion_mark_complete(&completion); } static void sanity_check(void) @@ -693,15 +692,15 @@ void commands_init(void) } fatal_assert(0 == uv_rwlock_init(&exclusive_rwlock)); - init_completion(&completion); + completion_init(&completion); error = uv_thread_create(&thread, command_thread, NULL); if (error) { error("uv_thread_create(): %s", uv_strerror(error)); goto after_error; } /* wait for worker thread to initialize */ - wait_for_completion(&completion); - destroy_completion(&completion); + completion_wait_for(&completion); + completion_destroy(&completion); uv_thread_set_name_np(thread, "DAEMON_COMMAND"); if (command_thread_error) { diff --git a/daemon/common.h b/daemon/common.h index c892dbdb1..5354e2ae0 100644 --- a/daemon/common.h +++ b/daemon/common.h @@ -79,8 +79,8 @@ // the netdata daemon #include "daemon.h" #include "main.h" +#include "static_threads.h" #include "signals.h" -#include "service.h" #include "commands.h" #include "analytics.h" diff --git a/daemon/global_statistics.c b/daemon/global_statistics.c index a152a00ae..f4f3e5762 100644 --- a/daemon/global_statistics.c +++ b/daemon/global_statistics.c @@ -172,7 +172,7 @@ static inline void global_statistics_copy(struct global_statistics *gs, uint8_t #endif } -void global_statistics_charts(void) { +static void global_statistics_charts(void) { static unsigned long long old_web_requests = 0, old_web_usec = 0, old_content_size = 0, diff --git a/daemon/global_statistics.h b/daemon/global_statistics.h index c200a693b..268b5319e 100644 --- a/daemon/global_statistics.h +++ b/daemon/global_statistics.h @@ -8,17 +8,6 @@ // ---------------------------------------------------------------------------- // global statistics -#define NETDATA_PLUGIN_HOOK_GLOBAL_STATISTICS \ - {.name = "GLOBAL_STATS", \ - .config_section = NULL, \ - .config_name = NULL, \ - .enabled = 1, \ - .thread = NULL, \ - .init_routine = NULL, \ - .start_routine = global_statistics_main}, - -extern void *global_statistics_main(void *ptr); - extern void rrdr_query_completed(uint64_t db_points_read, uint64_t result_points_generated); extern void finished_web_request_statistics(uint64_t dt, @@ -29,6 +18,5 @@ extern void finished_web_request_statistics(uint64_t dt, extern uint64_t web_client_connected(void); extern void web_client_disconnected(void); -extern void global_statistics_charts(void); #endif /* NETDATA_GLOBAL_STATISTICS_H */ diff --git a/daemon/main.c b/daemon/main.c index 2ec5c33f9..7c8e09a5f 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -2,10 +2,13 @@ #include "common.h" #include "buildinfo.h" +#include "static_threads.h" int netdata_zero_metrics_enabled; int netdata_anonymous_statistics_enabled; +struct netdata_static_thread *static_threads; + struct config netdata_config = { .first_section = NULL, .last_section = NULL, @@ -76,41 +79,6 @@ void netdata_cleanup_and_exit(int ret) { exit(ret); } -struct netdata_static_thread static_threads[] = { - NETDATA_PLUGIN_HOOK_GLOBAL_STATISTICS - - NETDATA_PLUGIN_HOOK_CHECKS - NETDATA_PLUGIN_HOOK_FREEBSD - NETDATA_PLUGIN_HOOK_MACOS - - // linux internal plugins - NETDATA_PLUGIN_HOOK_LINUX_PROC - NETDATA_PLUGIN_HOOK_LINUX_DISKSPACE - NETDATA_PLUGIN_HOOK_LINUX_TIMEX - NETDATA_PLUGIN_HOOK_LINUX_CGROUPS - NETDATA_PLUGIN_HOOK_LINUX_TC - - NETDATA_PLUGIN_HOOK_IDLEJITTER - NETDATA_PLUGIN_HOOK_STATSD - -#if defined(ENABLE_ACLK) || defined(ACLK_NG) - NETDATA_ACLK_HOOK -#endif - - // common plugins for all systems - {"BACKENDS", NULL, NULL, 1, NULL, NULL, backends_main}, - {"EXPORTING", NULL, NULL, 1, NULL, NULL, exporting_main}, - {"WEB_SERVER[static1]", NULL, NULL, 0, NULL, NULL, socket_listen_main_static_threaded}, - {"STREAM", NULL, NULL, 0, NULL, NULL, rrdpush_sender_thread}, - - NETDATA_PLUGIN_HOOK_PLUGINSD - NETDATA_PLUGIN_HOOK_HEALTH - NETDATA_PLUGIN_HOOK_ANALYTICS - NETDATA_PLUGIN_HOOK_SERVICE - - {NULL, NULL, NULL, 0, NULL, NULL, NULL} -}; - void web_server_threading_selection(void) { web_server_mode = web_server_mode_id(config_get(CONFIG_SECTION_WEB, "mode", web_server_mode_name(web_server_mode))); @@ -281,6 +249,8 @@ void cancel_main_threads() { } else info("All threads finished."); + + free(static_threads); } struct option_def option_definitions[] = { @@ -723,6 +693,7 @@ int main(int argc, char **argv) { size_t default_stacksize; char *user = NULL; + static_threads = static_threads_get(); netdata_ready=0; // set the name for logging diff --git a/daemon/main.h b/daemon/main.h index 4000ab70b..63d6c5a09 100644 --- a/daemon/main.h +++ b/daemon/main.h @@ -7,10 +7,6 @@ extern struct config netdata_config; -#define NETDATA_MAIN_THREAD_RUNNING CONFIG_BOOLEAN_YES -#define NETDATA_MAIN_THREAD_EXITING (CONFIG_BOOLEAN_YES + 1) -#define NETDATA_MAIN_THREAD_EXITED CONFIG_BOOLEAN_NO - /** * This struct contains information about command line options. */ @@ -26,20 +22,6 @@ struct option_def { const char *default_value; }; -struct netdata_static_thread { - char *name; // the name of the thread as it should appear in the logs - - char *config_section; // the section of netdata.conf to check if this is enabled or not - char *config_name; // the name of the config option to check if it is true or false - - volatile sig_atomic_t enabled; // the current status of the thread - - netdata_thread_t *thread; // internal use, to maintain a pointer to the created thread - - void (*init_routine) (void); // an initialization function to run before spawning the thread - void *(*start_routine) (void *); // the threaded worker -}; - extern void cancel_main_threads(void); extern int killpid(pid_t pid); extern void netdata_cleanup_and_exit(int ret) NORETURN; diff --git a/daemon/service.c b/daemon/service.c index 9cba0694f..d3a4e5500 100644 --- a/daemon/service.c +++ b/daemon/service.c @@ -5,7 +5,7 @@ /* Run service jobs every X seconds */ #define SERVICE_HEARTBEAT 10 -void service_main_cleanup(void *ptr) +static void service_main_cleanup(void *ptr) { struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr; static_thread->enabled = NETDATA_MAIN_THREAD_EXITING; diff --git a/daemon/service.h b/daemon/service.h deleted file mode 100644 index cb03bec2c..000000000 --- a/daemon/service.h +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef NETDATA_SERVICE_H -#define NETDATA_SERVICE_H 1 - -#define NETDATA_PLUGIN_HOOK_SERVICE \ - { \ - .name = "SERVICE", \ - .config_section = NULL, \ - .config_name = NULL, \ - .enabled = 1, \ - .thread = NULL, \ - .init_routine = NULL, \ - .start_routine = service_main \ - }, - -extern void *service_main(void *ptr); - -#endif //NETDATA_SERVICE_H diff --git a/daemon/static_threads.c b/daemon/static_threads.c new file mode 100644 index 000000000..534b3c3d8 --- /dev/null +++ b/daemon/static_threads.c @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common.h" + +extern void *aclk_starter(void *ptr); +extern void *analytics_main(void *ptr); +extern void *checks_main(void *ptr); +extern void *cpuidlejitter_main(void *ptr); +extern void *global_statistics_main(void *ptr); +extern void *health_main(void *ptr); +extern void *pluginsd_main(void *ptr); +extern void *service_main(void *ptr); +extern void *statsd_main(void *ptr); + +const struct netdata_static_thread static_threads_common[] = { + { + .name = "PLUGIN[check]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "checks", + .enabled = 0, + .thread = NULL, + .init_routine = NULL, + .start_routine = checks_main + }, + { + .name = "PLUGIN[idlejitter]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "idlejitter", + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = cpuidlejitter_main + }, + { + .name = "ANALYTICS", + .config_section = NULL, + .config_name = NULL, + .enabled = 0, + .thread = NULL, + .init_routine = NULL, + .start_routine = analytics_main + }, + { + .name = "GLOBAL_STATS", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = global_statistics_main + }, + { + .name = "HEALTH", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = health_main + }, + { + .name = "PLUGINSD", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = pluginsd_main + }, + { + .name = "SERVICE", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = service_main + }, + { + .name = "STATSD", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = statsd_main + }, + { + .name = "BACKENDS", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = backends_main + }, + { + .name = "EXPORTING", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = exporting_main + }, + { + .name = "STREAM", + .config_section = NULL, + .config_name = NULL, + .enabled = 0, + .thread = NULL, + .init_routine = NULL, + .start_routine = rrdpush_sender_thread + }, + { + .name = "WEB_SERVER[static1]", + .config_section = NULL, + .config_name = NULL, + .enabled = 0, + .thread = NULL, + .init_routine = NULL, + .start_routine = socket_listen_main_static_threaded + }, + +#if defined(ENABLE_ACLK) || defined(ACLK_NG) + { + .name = "ACLK_Main", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = aclk_starter + }, +#endif + + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +struct netdata_static_thread * +static_threads_concat(const struct netdata_static_thread *lhs, + const struct netdata_static_thread *rhs) +{ + struct netdata_static_thread *res; + + int lhs_size = 0; + for (; lhs[lhs_size].name; lhs_size++) {} + + int rhs_size = 0; + for (; rhs[rhs_size].name; rhs_size++) {} + + res = callocz(lhs_size + rhs_size + 1, sizeof(struct netdata_static_thread)); + + for (int i = 0; i != lhs_size; i++) + memcpy(&res[i], &lhs[i], sizeof(struct netdata_static_thread)); + + for (int i = 0; i != rhs_size; i++) + memcpy(&res[lhs_size + i], &rhs[i], sizeof(struct netdata_static_thread)); + + return res; +} diff --git a/daemon/static_threads.h b/daemon/static_threads.h new file mode 100644 index 000000000..dac615e76 --- /dev/null +++ b/daemon/static_threads.h @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_STATIC_THREADS_H +#define NETDATA_STATIC_THREADS_H + +#include "common.h" + +struct netdata_static_thread { + // the name of the thread as it should appear in the logs + char *name; + + // the section of netdata.conf to check if this is enabled or not + char *config_section; + + // the name of the config option to check if it is true or false + char *config_name; + + // the current status of the thread + volatile sig_atomic_t enabled; + + // internal use, to maintain a pointer to the created thread + netdata_thread_t *thread; + + // an initialization function to run before spawning the thread + void (*init_routine) (void); + + // the threaded worker + void *(*start_routine) (void *); +}; + +#define NETDATA_MAIN_THREAD_RUNNING CONFIG_BOOLEAN_YES +#define NETDATA_MAIN_THREAD_EXITING (CONFIG_BOOLEAN_YES + 1) +#define NETDATA_MAIN_THREAD_EXITED CONFIG_BOOLEAN_NO + +extern const struct netdata_static_thread static_threads_common[]; +extern const struct netdata_static_thread static_threads_linux[]; +extern const struct netdata_static_thread static_threads_freebsd[]; +extern const struct netdata_static_thread static_threads_macos[]; + +struct netdata_static_thread * +static_threads_concat(const struct netdata_static_thread *lhs, + const struct netdata_static_thread *rhs); + +struct netdata_static_thread *static_threads_get(); + +#endif /* NETDATA_STATIC_THREADS_H */ diff --git a/daemon/static_threads_freebsd.c b/daemon/static_threads_freebsd.c new file mode 100644 index 000000000..48066bff5 --- /dev/null +++ b/daemon/static_threads_freebsd.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common.h" + +extern void *freebsd_main(void *ptr); + +const struct netdata_static_thread static_threads_freebsd[] = { + { + .name = "PLUGIN[freebsd]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "freebsd", + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = freebsd_main + }, + + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +const struct netdata_static_thread static_threads_linux[] = { + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +const struct netdata_static_thread static_threads_macos[] = { + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +struct netdata_static_thread *static_threads_get() { + return static_threads_concat(static_threads_common, static_threads_freebsd); +} diff --git a/daemon/static_threads_linux.c b/daemon/static_threads_linux.c new file mode 100644 index 000000000..e55c0fec7 --- /dev/null +++ b/daemon/static_threads_linux.c @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common.h" + +extern void *cgroups_main(void *ptr); +extern void *proc_main(void *ptr); +extern void *diskspace_main(void *ptr); +extern void *tc_main(void *ptr); +extern void *timex_main(void *ptr); + +const struct netdata_static_thread static_threads_linux[] = { + { + .name = "PLUGIN[timex]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "timex", + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = timex_main + }, + { + .name = "PLUGIN[tc]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "tc", + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = tc_main + }, + { + .name = "PLUGIN[diskspace]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "diskspace", + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = diskspace_main + }, + { + .name = "PLUGIN[proc]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "proc", + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = proc_main + }, + { + .name = "PLUGIN[cgroups]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "cgroups", + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = cgroups_main + }, + + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +const struct netdata_static_thread static_threads_freebsd[] = { + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +const struct netdata_static_thread static_threads_macos[] = { + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +struct netdata_static_thread *static_threads_get() { + return static_threads_concat(static_threads_common, static_threads_linux); +} diff --git a/daemon/static_threads_macos.c b/daemon/static_threads_macos.c new file mode 100644 index 000000000..ae34a1363 --- /dev/null +++ b/daemon/static_threads_macos.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common.h" + +extern void *macos_main(void *ptr); + +const struct netdata_static_thread static_threads_macos[] = { + { + .name = "PLUGIN[macos]", + .config_section = CONFIG_SECTION_PLUGINS, + .config_name = "macos", + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = macos_main + }, + + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +const struct netdata_static_thread static_threads_freebsd[] = { + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +const struct netdata_static_thread static_threads_linux[] = { + {NULL, NULL, NULL, 0, NULL, NULL, NULL} +}; + +struct netdata_static_thread *static_threads_get() { + return static_threads_concat(static_threads_common, static_threads_macos); +} diff --git a/daemon/system-info.sh b/daemon/system-info.sh index 13c9b90bd..728e38091 100755 --- a/daemon/system-info.sh +++ b/daemon/system-info.sh @@ -335,7 +335,7 @@ else # These translate to the prefixs of files in `/dev` indicating the device type. # They are sorted by lowest used device major number, with dynamically assigned ones at the end. # We use this to look up device major numbers in `/proc/devices` - device_names='hd sd mfm ad ftl pd nftl dasd intfl mmcblk ub xvd rfd vbd nvme' + device_names='hd sd mfm ad ftl pd nftl dasd intfl mmcblk ub xvd rfd vbd nvme virtblk blkext' for name in ${device_names}; do if grep -qE " ${name}\$" /proc/devices; then diff --git a/daemon/unit_test.c b/daemon/unit_test.c index 2dcc88c45..456dff961 100644 --- a/daemon/unit_test.c +++ b/daemon/unit_test.c @@ -1181,9 +1181,9 @@ int run_test(struct test *test) calculated_number v = unpack_storage_number(rd->values[c]); calculated_number n = unpack_storage_number(pack_storage_number(test->results[c], SN_DEFAULT_FLAGS)); int same = (calculated_number_round(v * 10000000.0) == calculated_number_round(n * 10000000.0))?1:0; - fprintf(stderr, " %s/%s: checking position %lu (at %lu secs), expecting value " CALCULATED_NUMBER_FORMAT ", found " CALCULATED_NUMBER_FORMAT ", %s\n", + fprintf(stderr, " %s/%s: checking position %lu (at %"PRId64" secs), expecting value " CALCULATED_NUMBER_FORMAT ", found " CALCULATED_NUMBER_FORMAT ", %s\n", test->name, rd->name, c+1, - (rrdset_first_entry_t(st) + c * st->update_every) - time_start, + (int64_t)((rrdset_first_entry_t(st) + c * st->update_every) - time_start), n, v, (same)?"OK":"### E R R O R ###"); if(!same) errors++; @@ -1192,9 +1192,9 @@ int run_test(struct test *test) v = unpack_storage_number(rd2->values[c]); n = test->results2[c]; same = (calculated_number_round(v * 10000000.0) == calculated_number_round(n * 10000000.0))?1:0; - fprintf(stderr, " %s/%s: checking position %lu (at %lu secs), expecting value " CALCULATED_NUMBER_FORMAT ", found " CALCULATED_NUMBER_FORMAT ", %s\n", + fprintf(stderr, " %s/%s: checking position %lu (at %"PRId64" secs), expecting value " CALCULATED_NUMBER_FORMAT ", found " CALCULATED_NUMBER_FORMAT ", %s\n", test->name, rd2->name, c+1, - (rrdset_first_entry_t(st) + c * st->update_every) - time_start, + (int64_t)((rrdset_first_entry_t(st) + c * st->update_every) - time_start), n, v, (same)?"OK":"### E R R O R ###"); if(!same) errors++; } @@ -1917,7 +1917,7 @@ static void generate_dbengine_chart(void *arg) thread_info->rd[j] = rd[j] = rrddim_add(st, name, NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } - complete(&thread_info->charts_initialized); + completion_mark_complete(&thread_info->charts_initialized); // feed it with the test data time_current = time_present - history_seconds; @@ -1986,10 +1986,10 @@ void generate_dbengine_dataset(unsigned history_seconds) thread_info[i]->time_present = time_present; thread_info[i]->time_max = 0; thread_info[i]->done = 0; - init_completion(&thread_info[i]->charts_initialized); + completion_init(&thread_info[i]->charts_initialized); assert(0 == uv_thread_create(&thread_info[i]->thread, generate_dbengine_chart, thread_info[i])); - wait_for_completion(&thread_info[i]->charts_initialized); - destroy_completion(&thread_info[i]->charts_initialized); + completion_wait_for(&thread_info[i]->charts_initialized); + completion_destroy(&thread_info[i]->charts_initialized); } for (i = 0 ; i < DSET_CHARTS ; ++i) { assert(0 == uv_thread_join(&thread_info[i]->thread)); @@ -2177,13 +2177,13 @@ void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsi chart_threads[i]->time_max = 0; chart_threads[i]->done = 0; chart_threads[i]->errors = chart_threads[i]->stored_metrics_nr = 0; - init_completion(&chart_threads[i]->charts_initialized); + completion_init(&chart_threads[i]->charts_initialized); assert(0 == uv_thread_create(&chart_threads[i]->thread, generate_dbengine_chart, chart_threads[i])); } /* barrier so that subsequent queries can access valid chart data */ for (i = 0 ; i < DSET_CHARTS ; ++i) { - wait_for_completion(&chart_threads[i]->charts_initialized); - destroy_completion(&chart_threads[i]->charts_initialized); + completion_wait_for(&chart_threads[i]->charts_initialized); + completion_destroy(&chart_threads[i]->charts_initialized); } sleep(RAMP_UP_SECONDS); /* at this point data have already began being written to the database */ |