analytics.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 39
  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. size_t data_length;
  57. uint8_t prometheus_hits;
  58. uint8_t shell_hits;
  59. uint8_t json_hits;
  60. uint8_t dashboard_hits;
  61. };
  62. extern void analytics_get_data(char *name, BUFFER *wb);
  63. extern void set_late_global_environment(void);
  64. extern void analytics_free_data(void);
  65. extern void set_global_environment(void);
  66. extern void send_statistics(const char *action, const char *action_result, const char *action_data);
  67. extern void analytics_log_shell(void);
  68. extern void analytics_log_json(void);
  69. extern void analytics_log_prometheus(void);
  70. extern void analytics_log_dashboard(void);
  71. extern void analytics_gather_mutable_meta_data(void);
  72. extern void analytics_report_oom_score(long long int score);
  73. extern void get_system_timezone(void);
  74. extern struct analytics_data analytics_data;
  75. #endif //NETDATA_ANALYTICS_H