Skip to content

Commit

Permalink
Add sentry fatal message breadcrumb. (netdata#19608)
Browse files Browse the repository at this point in the history
Add fatal message breadcrumb.
  • Loading branch information
vkalintiris authored Feb 11, 2025
1 parent 71397d5 commit e12fcdb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/daemon/daemon-shutdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ void netdata_cleanup_and_exit(int ret, const char *action, const char *action_re

#ifdef ENABLE_SENTRY
if (ret) {
if (action_data) {
nd_sentry_add_breadcrumb(action_data);
}
abort();
} else {
nd_sentry_fini();
Expand Down
9 changes: 9 additions & 0 deletions src/daemon/sentry-native/sentry-native.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ void nd_sentry_set_user(const char *guid)
sentry_value_set_by_key(user, "id", sentry_value_new_string(guid));
sentry_set_user(user);
}

void nd_sentry_add_breadcrumb(const char *message)
{
if (sentry_telemetry_disabled())
return;

sentry_value_t crumb = sentry_value_new_breadcrumb("fatal", message);
sentry_add_breadcrumb(crumb);
}
1 change: 1 addition & 0 deletions src/daemon/sentry-native/sentry-native.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ void nd_sentry_init(void);
void nd_sentry_fini(void);

void nd_sentry_set_user(const char *guid);
void nd_sentry_add_breadcrumb(const char *message);

#endif /* ND_SENTRY_H */

0 comments on commit e12fcdb

Please sign in to comment.