diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-01-26 18:05:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-01-26 18:05:10 +0000 |
commit | 34a0b66bc2d48223748ed1cf5bc1b305c396bd74 (patch) | |
tree | fbd36be86cc6bc4288fe627f2b5beada569848bb /daemon/buildinfo.c | |
parent | Adding upstream version 1.32.1. (diff) | |
download | netdata-34a0b66bc2d48223748ed1cf5bc1b305c396bd74.tar.xz netdata-34a0b66bc2d48223748ed1cf5bc1b305c396bd74.zip |
Adding upstream version 1.33.0.upstream/1.33.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/buildinfo.c')
-rw-r--r-- | daemon/buildinfo.c | 153 |
1 files changed, 79 insertions, 74 deletions
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"); |