analytics.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #define NETDATA_PLUGIN_HOOK_ANALYTICS \
  15. { \
  16. .name = "ANALYTICS", \
  17. .config_section = NULL, \
  18. .config_name = NULL, \
  19. .enabled = 0, \
  20. .thread = NULL, \
  21. .init_routine = NULL, \
  22. .start_routine = analytics_main \
  23. },
  24. /* Needed to calculate the space needed for parameters */
  25. #define ANALYTICS_NO_OF_ITEMS 38
  26. struct analytics_data {
  27. char *netdata_config_stream_enabled;
  28. char *netdata_config_memory_mode;
  29. char *netdata_exporting_connectors;
  30. char *netdata_config_exporting_enabled;
  31. char *netdata_allmetrics_prometheus_used;
  32. char *netdata_allmetrics_shell_used;
  33. char *netdata_allmetrics_json_used;
  34. char *netdata_dashboard_used;
  35. char *netdata_collectors;
  36. char *netdata_collectors_count;
  37. char *netdata_buildinfo;
  38. char *netdata_config_page_cache_size;
  39. char *netdata_config_multidb_disk_quota;
  40. char *netdata_config_https_enabled;
  41. char *netdata_config_web_enabled;
  42. char *netdata_config_release_channel;
  43. char *netdata_mirrored_host_count;
  44. char *netdata_mirrored_hosts_reachable;
  45. char *netdata_mirrored_hosts_unreachable;
  46. char *netdata_notification_methods;
  47. char *netdata_alarms_normal;
  48. char *netdata_alarms_warning;
  49. char *netdata_alarms_critical;
  50. char *netdata_charts_count;
  51. char *netdata_metrics_count;
  52. char *netdata_config_is_parent;
  53. char *netdata_config_hosts_available;
  54. char *netdata_host_cloud_available;
  55. char *netdata_host_aclk_available;
  56. char *netdata_host_aclk_implementation;
  57. char *netdata_host_agent_claimed;
  58. char *netdata_host_cloud_enabled;
  59. char *netdata_config_https_available;
  60. char *netdata_install_type;
  61. char *netdata_config_is_private_registry;
  62. char *netdata_config_use_private_registry;
  63. char *netdata_config_oom_score;
  64. char *netdata_prebuilt_distro;
  65. size_t data_length;
  66. uint8_t prometheus_hits;
  67. uint8_t shell_hits;
  68. uint8_t json_hits;
  69. uint8_t dashboard_hits;
  70. };
  71. extern void *analytics_main(void *ptr);
  72. extern void analytics_get_data(char *name, BUFFER *wb);
  73. extern void set_late_global_environment(void);
  74. extern void analytics_free_data(void);
  75. extern void set_global_environment(void);
  76. extern void send_statistics(const char *action, const char *action_result, const char *action_data);
  77. extern void analytics_log_shell(void);
  78. extern void analytics_log_json(void);
  79. extern void analytics_log_prometheus(void);
  80. extern void analytics_log_dashboard(void);
  81. extern void analytics_gather_mutable_meta_data(void);
  82. extern void analytics_report_oom_score(long long int score);
  83. extern void get_system_timezone(void);
  84. extern struct analytics_data analytics_data;
  85. #endif //NETDATA_ANALYTICS_H