Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,8 @@ SENTRY_API void sentry_user_consent_reset(void);
SENTRY_API sentry_user_consent_t sentry_user_consent_get(void);

/**
* Sends a sentry event.
* Sends a sentry event. Returns a nil UUID if the event being passed in is a
* transaction; `sentry_transaction_finish` should be used to send transactions.
*/
SENTRY_API sentry_uuid_t sentry_capture_event(sentry_value_t event);

Expand Down
16 changes: 15 additions & 1 deletion src/sentry_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,28 @@ sentry__event_is_transaction(sentry_value_t event)

sentry_uuid_t
sentry_capture_event(sentry_value_t event)
{
if (sentry__event_is_transaction(event)) {
return sentry_uuid_nil();
} else {
return sentry__capture_event(event);
}
}

sentry_uuid_t
sentry__capture_event(sentry_value_t event)
{
sentry_uuid_t event_id;
sentry_envelope_t *envelope = NULL;

bool was_captured = false;
SENTRY_WITH_OPTIONS (options) {
was_captured = true;
envelope = sentry__prepare_event(options, event, &event_id);
if (sentry__event_is_transaction(event)) {
return sentry_uuid_nil();
} else {
envelope = sentry__prepare_event(options, event, &event_id);
}
if (envelope) {
if (options->session) {
SENTRY_WITH_OPTIONS_MUT (mut_options) {
Expand Down
5 changes: 5 additions & 0 deletions src/sentry_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ bool sentry__event_is_transaction(sentry_value_t event);
sentry_envelope_t *sentry__prepare_event(const sentry_options_t *options,
sentry_value_t event, sentry_uuid_t *event_id);

/**
* Sends a sentry event, regardless of its type.
*/
sentry_uuid_t sentry__capture_event(sentry_value_t event);

/**
* This function will submit the `envelope` to the given `transport`, first
* checking for consent.
Expand Down