Skip to content

sentry-native C++ app not reporting any user information after sentry_set_user #873

@chrisdalke

Description

@chrisdalke

Description

I can't get seem to get sentry-native in my C++ application to send any user information along with message events or crash events, even after using sentry_set_user.

See code below. I construct the sentry options, then the user, then call sentry_init, and send a test event. Neither the test event or crash events show any user information in the Sentry UI.

I am, however, able to add any builtin tags, for example I can set the environment name to the user's hostname and that shows in both the normal messages and crash dumps. This could solve our use case but ideally we'd like to use real user tracking and sessions.

Am I using the user object wrong?

Appreciate the help!

When does the problem happen

  • During build
  • During run-time
  • When capturing a hard crash

Environment

  • OS: Ubuntu 22.04, 64-bit
  • Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  • CMake version and config: cmake version 3.26.3, SENTRY_BACKEND=crashpad, CMAKE_BUILD_TYPE=RelWithDebInfo

Steps To Reproduce

My initialization sequence:

sentry_options_t *options = sentry_options_new();
sentry_options_set_dsn(options, "...");
sentry_options_set_database_path(options, m_application_path.absoluteFilePath("sentry").toStdString().c_str());
sentry_options_set_release(options, QString("...@" + m_version).toStdString().c_str());
sentry_options_set_auto_session_tracking(options, true);
sentry_options_set_symbolize_stacktraces(options, true);
sentry_options_set_environment(options, hostname.toStdString().c_str());
sentry_options_set_debug(options, 0);

sentry_value_t user = sentry_value_new_object();
//Tried a number of fields, and tried using only one field...
//sentry_value_set_by_key(user, "ip_address", sentry_value_new_string("{{auto}}"));
//sentry_value_set_by_key(user, "username", sentry_value_new_string(hostname.toStdString().c_str()));
sentry_value_set_by_key(user, "id", sentry_value_new_string("test"));
sentry_set_user(user);

sentry_init(options);

sentry_value_t event = sentry_value_new_message_event(SENTRY_LEVEL_INFO, "core", "Application startup heartbeat");
sentry_capture_event(event);

Log output

N/A -- Sentry not outputting any debug information related to the user info. can provide if relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions