Skip to content

Feature Request: Share Context Between App and Out-Of-Proc Crash Handler to support Breadcrumbs #1197

@zsd4yr

Description

@zsd4yr

Our scenario is that we have 2 applications involved in crash handling on windows

  1. Our out-of-process dedicated crash handler; and
  2. The app under observation

Some details on our out-of-proc handler

  • integrates with sentry for uploading crash minidumps with context, attachments, and user info
  • integrates with google breakpad to generate the minidumps.
  • We do not use a sentry backend and instead pass up the fully generated minidump via sentry_capture_minidump

In general, our flow looks like this

  1. Primary application starts
  2. Spawns out-of-proc crash handler process
  3. Primary app writes out relevant application information -- name, changelist/version, environment, any tags or contextual info, paths to relevant files for later attachment to the event -- to a file to be used by the handler
  4. Primary app crashes
  5. Handler observes this crash and creates a dump with google breakpad
  6. Handler reads out the data from step 3
  7. Handler interacts with sentry in the following order (code is simplified)
# read out file with relevant sentry info #
# ...

# Basic bootstrapping
sentry_set_level(SENTRY_LEVEL_DEBUG);

auto options = sentry_options_new();
sentry_options_set_dsn(options, httpsUr);
sentry_options_set_backend(options, NULL); 

sentry_options_set_debug(options, 1); 
sentry_options_set_logger_level(options, SENTRY_LEVEL_DEBUG);
sentry_options_set_logger(options, OnSentryLoggerCallback, nullptr);

# add Environment and Release info
sentry_options_set_environment(options, environment);
sentry_options_set_release(options, release);

# add attachments
for (const auto& attachment : attachments)
{
    sentry_options_add_attachmentw(options, attachmentVerifiedFilePath);
}

sentry_init(options);
sentry_start_session();

# add User Info
const auto sentryUser= sentry_value_new_object();
for(const auto& entry : userInfo.entries) 
{
     sentry_value_set_by_key(sentryUser, entry.name, entry.value);
     # set a tag as well as context elements are not easily searchable in the UI
     sentry_set_tag(entry.name, entry.value);
} 
sentry_set_user(sentryUser);

# add Contexts
for (const auto& contextBlob : contextBlobs)
{
    const auto contextObject = sentry_value_new_object();
    for(const auto& entry : contextBlob.entries) 
    {
        sentry_value_set_by_key(contextObject, entry.name, entry.value);
        # set a tag as well as context elements are not easily searchable in the UI
        sentry_set_tag(entry.name, entry.value);
    } 
    entry_set_context(contextBlob.name, contextObject);
}

# add Tags
for (const auto& tagEntry : tags) 
{
    sentry_set_tag(tagEntry.name, tagEntry.value);
}

# upload time
sentry_uuid_t eventUuid = sentry_uuid_nil();
eventUuid = sentry_capture_minidump(dumpPath);

# check if it worked
char event_name[37];
sentry_uuid_as_string(&eventUuid, event_name);

sentry_close();

const bool success = !sentry_uuid_is_nil(&eventUuid);
if (success)
{
   auto eventId = event_name.replace("-", "");
   printf("Event uploaded successful. ID is %s", eventId);
}

What I would love to be able to do is enable breadcrumbs in this scenario at all - either

  • allow the primary application to specify breadcrumbs using the sentry native SDK and then somehow "share context" between the App and Out-Of-Proc Crash Handle; or
  • allow me to specify breadcrumbs with a NULL bbackend and I would be happy to "pass around" the breadcrumbs with a file or something as we do with other stuff

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions