Skip to content

Commit

Permalink
Set sentry user name from message data instead of environment var
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Jan 15, 2024
1 parent dbdabb3 commit 0ca2e9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cura.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ message Slice
string sentry_id = 6; // The anonymized Sentry user id that requested the slice
string cura_version = 7; // The version of Cura that requested the slice
optional string project_name = 8; // The name of the project that requested the slice
optional string user_name = 9; // The Digital Factory account name of the user that requested the slice
}

message Extruder
Expand Down
6 changes: 3 additions & 3 deletions src/communication/ArcusCommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,10 @@ void ArcusCommunication::sliceNext()
#ifdef SENTRY_URL
sentry_value_t user = sentry_value_new_object();
sentry_value_set_by_key(user, "id", sentry_value_new_string(slice_message->sentry_id().c_str()));
if (const auto sentry_user = spdlog::details::os::getenv("CURAENGINE_SENTRY_USER"); ! sentry_user.empty())
if (slice_message->has_user_name())
{
spdlog::debug("Setting Sentry user to {}", sentry_user);
sentry_value_set_by_key(user, "username", sentry_value_new_string(sentry_user.c_str()));
spdlog::debug("Setting Sentry user to {}", slice_message->user_name());
sentry_value_set_by_key(user, "username", sentry_value_new_string(slice_message->user_name().c_str()));
}
sentry_set_user(user);
sentry_set_tag("cura.version", slice_message->cura_version().c_str());
Expand Down

0 comments on commit 0ca2e9b

Please sign in to comment.