diff options
author | Chris Akritidis <43294513+cakrit@users.noreply.github.com> | 2019-01-27 12:35:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-27 12:35:09 +0200 |
commit | 2a5074ad432f41b942bdee845975b4d8ec527361 (patch) | |
tree | 8122ef6b231b9dd46cefba55cef0fc5fa3613d76 /libnetdata | |
parent | d5e1197de6c8dcacfdaab1f99a83db450ecbe675 (diff) |
Anonymous statistics (#5113)
* Added shell and dashboard anonymous statistics
* Check for environment var NETDATA_REGISTRY_UNIQUE_ID
* Fix indentation
* Removed health-cmdapi-test
* docs/anonymous-statistics.md
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/libnetdata.h | 2 | ||||
-rw-r--r-- | libnetdata/log/log.c | 7 | ||||
-rw-r--r-- | libnetdata/log/log.h | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/libnetdata/libnetdata.h b/libnetdata/libnetdata.h index 0bac3dc8ff..8d9be336b9 100644 --- a/libnetdata/libnetdata.h +++ b/libnetdata/libnetdata.h @@ -283,8 +283,8 @@ extern void recursive_config_double_dir_load( extern void netdata_cleanup_and_exit(int ret) NORETURN; +extern void send_statistics(const char *action, const char *action_result, const char *action_data); extern char *netdata_configured_host_prefix; - #include "os.h" #include "storage_number/storage_number.h" #include "threads/threads.h" diff --git a/libnetdata/log/log.c b/libnetdata/log/log.c index 198e98bd9f..caf21696b6 100644 --- a/libnetdata/log/log.c +++ b/libnetdata/log/log.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later +#include <daemon/main.h> #include "../libnetdata.h" int web_server_is_multithreaded = 1; @@ -400,6 +401,12 @@ void fatal_int( const char *file, const char *function, const unsigned long line log_unlock(); + static char action_data[60]; + snprintfz(action_data, 60, "%04lu@%-10.10s:%-15.15s", line, file, function); + static char action_result[60]; + snprintfz(action_result, 60, "%s:%s",program_name, netdata_thread_tag()); + send_statistics("FATAL", action_result, action_data); + netdata_cleanup_and_exit(1); } diff --git a/libnetdata/log/log.h b/libnetdata/log/log.h index 48e1599a7b..44670f31c5 100644 --- a/libnetdata/log/log.h +++ b/libnetdata/log/log.h @@ -85,6 +85,7 @@ static inline void debug_dummy(void) {} #define error(args...) error_int("ERROR", __FILE__, __FUNCTION__, __LINE__, ##args) #define fatal(args...) fatal_int(__FILE__, __FUNCTION__, __LINE__, ##args) +extern void send_statistics(const char *action, const char *action_result, const char *action_data); extern void debug_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5); extern void info_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(4, 5); extern void error_int( const char *prefix, const char *file, const char *function, const unsigned long line, const char *fmt, ... ) PRINTFLIKE(5, 6); |