ml.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_ML_H
  3. #define NETDATA_ML_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #include "daemon/common.h"
  8. #include "web/api/queries/rrdr.h"
  9. // This is a DBEngine function redeclared here so that we can free
  10. // the anomaly rate dimension, whenever its backing dimension is freed.
  11. extern void rrddim_free(RRDSET *st, RRDDIM *rd);
  12. typedef void* ml_host_t;
  13. typedef void* ml_dimension_t;
  14. bool ml_capable();
  15. bool ml_enabled(RRDHOST *RH);
  16. void ml_init(void);
  17. void ml_new_host(RRDHOST *RH);
  18. void ml_delete_host(RRDHOST *RH);
  19. char *ml_get_host_info(RRDHOST *RH);
  20. char *ml_get_host_runtime_info(RRDHOST *RH);
  21. void ml_new_dimension(RRDDIM *RD);
  22. void ml_delete_dimension(RRDDIM *RD);
  23. bool ml_is_anomalous(RRDDIM *RD, double value, bool exists);
  24. char *ml_get_anomaly_events(RRDHOST *RH, const char *AnomalyDetectorName,
  25. int AnomalyDetectorVersion, time_t After, time_t Before);
  26. char *ml_get_anomaly_event_info(RRDHOST *RH, const char *AnomalyDetectorName,
  27. int AnomalyDetectorVersion, time_t After, time_t Before);
  28. void ml_process_rrdr(RRDR *R, int MaxAnomalyRates);
  29. void ml_dimension_update_name(RRDSET *RS, RRDDIM *RD, const char *name);
  30. bool ml_streaming_enabled();
  31. #define ML_ANOMALY_RATES_CHART_ID "anomaly_detection.anomaly_rates"
  32. #if defined(ENABLE_ML_TESTS)
  33. int test_ml(int argc, char *argv[]);
  34. #endif
  35. #ifdef __cplusplus
  36. };
  37. #endif
  38. #endif /* NETDATA_ML_H */