analytics.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_ANALYTICS_H
  3. #define NETDATA_ANALYTICS_H 1
  4. #include "daemon/common.h"
  5. /* Max number of seconds before the first META analytics is sent */
  6. #define ANALYTICS_INIT_SLEEP_SEC 120
  7. /* Send a META event every X seconds */
  8. #define ANALYTICS_HEARTBEAT 7200
  9. /* Maximum number of hits to log */
  10. #define ANALYTICS_MAX_PROMETHEUS_HITS 255
  11. #define ANALYTICS_MAX_SHELL_HITS 255
  12. #define ANALYTICS_MAX_JSON_HITS 255
  13. #define ANALYTICS_MAX_DASHBOARD_HITS 255
  14. /* Needed to calculate the space needed for parameters */
  15. #define ANALYTICS_NO_OF_ITEMS 40
  16. struct analytics_data {
  17. char *netdata_config_stream_enabled;
  18. char *netdata_config_memory_mode;
  19. char *netdata_exporting_connectors;
  20. char *netdata_config_exporting_enabled;
  21. char *netdata_allmetrics_prometheus_used;
  22. char *netdata_allmetrics_shell_used;
  23. char *netdata_allmetrics_json_used;
  24. char *netdata_dashboard_used;
  25. char *netdata_collectors;
  26. char *netdata_collectors_count;
  27. char *netdata_buildinfo;
  28. char *netdata_config_page_cache_size;
  29. char *netdata_config_multidb_disk_quota;
  30. char *netdata_config_https_enabled;
  31. char *netdata_config_web_enabled;
  32. char *netdata_config_release_channel;
  33. char *netdata_mirrored_host_count;
  34. char *netdata_mirrored_hosts_reachable;
  35. char *netdata_mirrored_hosts_unreachable;
  36. char *netdata_notification_methods;
  37. char *netdata_alarms_normal;
  38. char *netdata_alarms_warning;
  39. char *netdata_alarms_critical;
  40. char *netdata_charts_count;
  41. char *netdata_metrics_count;
  42. char *netdata_config_is_parent;
  43. char *netdata_config_hosts_available;
  44. char *netdata_host_cloud_available;
  45. char *netdata_host_aclk_available;
  46. char *netdata_host_aclk_protocol;
  47. char *netdata_host_aclk_implementation;
  48. char *netdata_host_agent_claimed;
  49. char *netdata_host_cloud_enabled;
  50. char *netdata_config_https_available;
  51. char *netdata_install_type;
  52. char *netdata_config_is_private_registry;
  53. char *netdata_config_use_private_registry;
  54. char *netdata_config_oom_score;
  55. char *netdata_prebuilt_distro;
  56. char *netdata_fail_reason;
  57. size_t data_length;
  58. size_t prometheus_hits;
  59. size_t shell_hits;
  60. size_t json_hits;
  61. size_t dashboard_hits;
  62. size_t charts_count;
  63. size_t metrics_count;
  64. bool exporting_enabled;
  65. };
  66. void set_late_global_environment(struct rrdhost_system_info *system_info);
  67. void analytics_free_data(void);
  68. void set_global_environment(void);
  69. void send_statistics(const char *action, const char *action_result, const char *action_data);
  70. void analytics_log_shell(void);
  71. void analytics_log_json(void);
  72. void analytics_log_prometheus(void);
  73. void analytics_log_dashboard(void);
  74. void analytics_gather_mutable_meta_data(void);
  75. void analytics_report_oom_score(long long int score);
  76. void get_system_timezone(void);
  77. extern struct analytics_data analytics_data;
  78. #endif //NETDATA_ANALYTICS_H