do not send sentry reports on rrd_init() failures (#19628)
Costa Tsaousis committed
Feb 12, 2025 at 13:22 UTC
772cc5fff584cb4f222327266522b89e87512173
3 files changed
+16
-1
src/daemon/daemon-shutdown.c
+11
-1
@@ -12,6 +12,16 @@
12
#include "sentry-native/sentry-native.h"
13
#endif
14
15
+static bool abort_on_fatal = true;
16
+
17
+void abort_on_fatal_disable(void) {
18
+ abort_on_fatal = false;
19
+}
20
+
21
+void abort_on_fatal_enable(void) {
22
+ abort_on_fatal = true;
23
+}
24
+
25
void web_client_cache_destroy(void);
26
27
extern struct netdata_static_thread *static_threads;
@@ -296,7 +306,7 @@ void netdata_cleanup_and_exit(int ret, const char *action, const char *action_re
306
#endif
307
308
#ifdef ENABLE_SENTRY
299
- if (ret) {
309
+ if (ret && abort_on_fatal) {
310
if (action_data) {
311
nd_sentry_add_breadcrumb(action_data);
312
}
src/daemon/daemon-shutdown.h
+3
@@ -7,4 +7,7 @@
7
8
void cancel_main_threads(void);
9
10
+void abort_on_fatal_disable(void);
11
+void abort_on_fatal_enable(void);
12
+
13
#endif //NETDATA_DAEMON_SHUTDOWN_H
src/daemon/main.c
+2
@@ -959,10 +959,12 @@ int netdata_main(int argc, char **argv) {
959
960
delta_startup_time("initialize RRD structures");
961
962
+ abort_on_fatal_disable();
963
if(rrd_init(netdata_configured_hostname, system_info, false)) {
964
set_late_analytics_variables(system_info);
965
fatal("Cannot initialize localhost instance with name '%s'.", netdata_configured_hostname);
966
}
967
+ abort_on_fatal_enable();
968
969
delta_startup_time("check for incomplete shutdown");
970