Skip to content

Commit

Permalink
logs-management: Disable logs management monitoring section (netdata#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dim-P authored Dec 3, 2023
1 parent 0e91d3f commit 48b2d16
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 746 deletions.
2 changes: 1 addition & 1 deletion collectors/plugins.d/plugins_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void *pluginsd_main(void *ptr)
// disable some plugins by default
config_get_boolean(CONFIG_SECTION_PLUGINS, "slabinfo", CONFIG_BOOLEAN_NO);
config_get_boolean(CONFIG_SECTION_PLUGINS, "logs-management",
#if defined(LOGS_MANAGEMENT_STRESS_TEST)
#if defined(LOGS_MANAGEMENT_DEV_MODE)
CONFIG_BOOLEAN_YES
#else
CONFIG_BOOLEAN_NO
Expand Down
4 changes: 0 additions & 4 deletions logsmanagement/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,4 @@ dist_logsmanagconfig_DATA = \

dist_noinst_DATA = \
README.md \
stress_test/logrotate.conf \
stress_test/logs_query.html \
stress_test/run_stress_test.sh \
stress_test/stress_test.c \
$(NULL)
4 changes: 2 additions & 2 deletions logsmanagement/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#define UPDATE_TIMEOUT_DEFAULT 10 /**< Default timeout to use to update charts if they haven't been updated in the meantime. **/

#if !defined(LOGS_MANAGEMENT_STRESS_TEST)
#if !defined(LOGS_MANAGEMENT_DEV_MODE)
#define ENABLE_COLLECTED_LOGS_TOTAL_DEFAULT CONFIG_BOOLEAN_NO /**< Default value to enable (or not) metrics of total collected log records **/
#else
#define ENABLE_COLLECTED_LOGS_TOTAL_DEFAULT CONFIG_BOOLEAN_YES /**< Default value to enable (or not) metrics of total collected log records, if stress tests are enabled **/
Expand Down Expand Up @@ -57,7 +57,7 @@ typedef enum {

#define DISK_SPACE_LIMIT_DEFAULT 500 /**< Global default configuration maximum database disk space limit per log source **/

#if !defined(LOGS_MANAGEMENT_STRESS_TEST)
#if !defined(LOGS_MANAGEMENT_DEV_MODE)
#define GLOBAL_DB_MODE_DEFAULT_STR "none" /**< db mode string to be used as global default in configuration **/
#define GLOBAL_DB_MODE_DEFAULT LOGS_MANAG_DB_MODE_NONE /**< db mode to be used as global default, matching GLOBAL_DB_MODE_DEFAULT_STR **/
#else
Expand Down
6 changes: 3 additions & 3 deletions logsmanagement/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#define LOGS_MANAG_STR(x) LOGS_MANAG_STR_HELPER(x)

#ifndef m_assert
#if defined(LOGS_MANAGEMENT_STRESS_TEST)
#if defined(LOGS_MANAGEMENT_DEV_MODE)
#define m_assert(expr, msg) assert(((void)(msg), (expr)))
#else
#define m_assert(expr, msg) do{} while(0)
#endif // LOGS_MANAGEMENT_STRESS_TEST
#endif // LOGS_MANAGEMENT_DEV_MODE
#endif // m_assert

/* Test if a timestamp is within a valid range
Expand All @@ -45,7 +45,7 @@
#define COMPILE_TIME_ASSERT(X) COMPILE_TIME_ASSERT2(X,__LINE__)
#endif // COMPILE_TIME_ASSERT

#if defined(NETDATA_INTERNAL_CHECKS) && defined(LOGS_MANAGEMENT_STRESS_TEST)
#if defined(NETDATA_INTERNAL_CHECKS) && defined(LOGS_MANAGEMENT_DEV_MODE)
#define debug_log(args...) netdata_logger(NDLS_COLLECTORS, NDLP_DEBUG, __FILE__, __FUNCTION__, __LINE__, ##args)
#else
#define debug_log(fmt, args...) do {} while(0)
Expand Down
27 changes: 13 additions & 14 deletions logsmanagement/logsmanagement.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
#include "logsmanagement/unit_test/unit_test.h"
#endif

#if defined(LOGS_MANAGEMENT_STRESS_TEST) && LOGS_MANAGEMENT_STRESS_TEST == 1
#include "query_test.h"
#endif // defined(LOGS_MANAGEMENT_STRESS_TEST)

netdata_mutex_t stdout_mut = NETDATA_MUTEX_INITIALIZER;

bool logsmanagement_should_exit = false;
Expand All @@ -35,8 +31,6 @@ struct File_infos_arr *p_file_infos_arr = NULL;

static uv_loop_t *main_loop;

static uv_thread_t stats_charts_thread_id;

static struct {
uv_signal_t sig;
const int signum;
Expand Down Expand Up @@ -193,7 +187,15 @@ int main(int argc, char **argv) {
exit(1);
}

fatal_assert(0 == uv_thread_create(&stats_charts_thread_id, stats_charts_init, &stdout_mut));
uv_thread_t *p_stats_charts_thread_id = NULL;
const char *const netdata_internals_monitoring = getenv("NETDATA_INTERNALS_MONITORING");
if( netdata_internals_monitoring &&
*netdata_internals_monitoring &&
strcmp(netdata_internals_monitoring, "YES") == 0){

p_stats_charts_thread_id = mallocz(sizeof(uv_thread_t));
fatal_assert(0 == uv_thread_create(p_stats_charts_thread_id, stats_charts_init, &stdout_mut));
}

#if defined(__STDC_VERSION__)
debug_log( "__STDC_VERSION__: %ld", __STDC_VERSION__);
Expand All @@ -204,12 +206,6 @@ int main(int argc, char **argv) {
debug_log( "LZ4 version: %s", LZ4_versionString());
debug_log( "SQLITE version: " SQLITE_VERSION);

#if defined(LOGS_MANAGEMENT_STRESS_TEST) && LOGS_MANAGEMENT_STRESS_TEST == 1
debug_log( "Running Netdata with logs_management stress test enabled!");
static uv_thread_t run_stress_test_queries_thread_id;
uv_thread_create(&run_stress_test_queries_thread_id, run_stress_test_queries_thread, NULL);
#endif // LOGS_MANAGEMENT_STRESS_TEST

for(int i = 0; i < (int) (sizeof(signals) / sizeof(signals[0])); i++){
uv_signal_init(main_loop, &signals[i].sig);
uv_signal_start(&signals[i].sig, signal_handler, signals[i].signum);
Expand All @@ -229,7 +225,10 @@ int main(int argc, char **argv) {
nd_log_limits_unlimited();

// TODO: Clean up stats charts memory
uv_thread_join(&stats_charts_thread_id);
if(p_stats_charts_thread_id){
uv_thread_join(p_stats_charts_thread_id);
freez(p_stats_charts_thread_id);
}

uv_stop(main_loop);

Expand Down
5 changes: 0 additions & 5 deletions logsmanagement/stress_test/logrotate.conf

This file was deleted.

186 changes: 0 additions & 186 deletions logsmanagement/stress_test/logs_query.html

This file was deleted.

Loading

0 comments on commit 48b2d16

Please sign in to comment.