Expand ml enabled option (#18761)
* Remove commented out code * ML - enabled option is now tri state (auto, yes, no)
Stelios Fragkakis committed
Oct 15, 2024 at 09:58 UTC
26be0dfbfc6c6a89efc18c030ba098f0c03941aa
3 files changed
+8
-8
src/daemon/main.c
-6
@@ -2111,12 +2111,6 @@ int netdata_main(int argc, char **argv) {
2111
health_set_silencers_filename();
2112
health_initialize_global_silencers();
2113
2114
-// // --------------------------------------------------------------------
2115
-// // Initialize ML configuration
2116
-//
2117
-// delta_startup_time("initialize ML");
2118
-// ml_init();
2119
-
2114
// --------------------------------------------------------------------
2115
// setup process signals
2116
src/ml/Config.cc
+7
-1
@@ -19,7 +19,7 @@ static T clamp(const T& Value, const T& Min, const T& Max) {
19
void ml_config_load(ml_config_t *cfg) {
20
const char *config_section_ml = CONFIG_SECTION_ML;
21
22
- bool enable_anomaly_detection = config_get_boolean(config_section_ml, "enabled", true);
22
+ int enable_anomaly_detection = config_get_boolean_ondemand(config_section_ml, "enabled", CONFIG_BOOLEAN_AUTO);
23
24
/*
25
* Read values
@@ -139,4 +139,10 @@ void ml_config_load(ml_config_t *cfg) {
139
cfg->suppression_threshold = suppression_threshold;
140
141
cfg->enable_statistics_charts = enable_statistics_charts;
142
+
143
+ if (cfg->enable_anomaly_detection == CONFIG_BOOLEAN_AUTO && default_rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE) {
144
+ Cfg.enable_anomaly_detection = 0;
145
+ config_set_boolean(config_section_ml, "enabled", CONFIG_BOOLEAN_NO);
146
+ return;
147
+ }
148
}
src/ml/ml-private.h
+1
-1
@@ -313,7 +313,7 @@ typedef struct {
313
} ml_training_thread_t;
314
315
typedef struct {
316
- bool enable_anomaly_detection;
316
+ int enable_anomaly_detection;
317
318
unsigned max_train_samples;
319
unsigned min_train_samples;