master
h 69 lines 1.99 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_ML_PUBLIC_H
4 #define NETDATA_ML_PUBLIC_H
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 #include "database/rrd.h"
11 #include "web/api/queries/rrdr.h"
12 #include "database/sqlite/vendored/sqlite3.h"
13
14 bool ml_capable();
15 bool ml_enabled(RRDHOST *rh);
16 bool ml_streaming_enabled();
17
18 void ml_init(void);
19 void ml_fini(void);
20
21 void ml_start_threads(void);
22 void ml_stop_threads(void);
23
24 void ml_host_new(RRDHOST *rh);
25 void ml_host_delete(RRDHOST *rh);
26
27 void ml_host_start(RRDHOST *RH);
28 void ml_host_stop(RRDHOST *RH);
29
30 void ml_host_get_info(RRDHOST *RH, BUFFER *wb);
31 void ml_host_get_detection_info(RRDHOST *RH, BUFFER *wb);
32 void ml_host_get_models(RRDHOST *RH, BUFFER *wb);
33
34 void ml_chart_new(RRDSET *rs);
35 void ml_chart_delete(RRDSET *rs);
36 bool ml_chart_update_begin(RRDSET *rs);
37 void ml_chart_update_end(RRDSET *rs);
38
39 void ml_dimension_new(RRDDIM *rd);
40 void ml_dimension_delete(RRDDIM *rd);
41 bool ml_dimension_is_anomalous(RRDDIM *rd, time_t curr_time, double value, bool exists);
42 void ml_dimension_received_anomaly(RRDDIM *rd, bool is_anomalous);
43
44 int ml_dimension_load_models(RRDDIM *rd, sqlite3_stmt **stmt);
45
46 void ml_update_global_statistics_charts(uint64_t models_consulted,
47 uint64_t models_received,
48 uint64_t models_sent,
49 uint64_t models_ignored,
50 uint64_t models_deserialization_failures,
51 uint64_t memory_consumption,
52 uint64_t memory_new,
53 uint64_t memory_delete);
54
55 bool ml_host_get_host_status(RRDHOST *rh, struct ml_metrics_statistics *mlm);
56 bool ml_host_running(RRDHOST *rh);
57 uint64_t sqlite_get_ml_space(void);
58
59 bool ml_model_received_from_child(RRDHOST *host, const char *json);
60
61 void ml_host_disconnected(RRDHOST *host);
62
63 int ml_unittest(void);
64
65 #ifdef __cplusplus
66 };
67 #endif
68
69 #endif /* NETDATA_ML_PUBLIC_H */