fix(slack): Use set_user for user context in Slack event webhook#112530
Merged
DominikB2014 merged 2 commits intomasterfrom Apr 8, 2026
Merged
Conversation
Replace set_tag("user.email", ...) with set_user({"email": ...}) so the
user email is properly stored as sentry.user.email in span attributes,
matching the EAP search attribute definition.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enrich the user context with id and username in addition to email, populating sentry.user.id and sentry.user.username on spans. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
edwardgou-sentry
approved these changes
Apr 8, 2026
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bbc6237. Configure here.
| sentry_sdk.set_tag("user.email", identity_user.email) | ||
| sentry_sdk.set_user( | ||
| { | ||
| "id": identity_user.id, |
Contributor
There was a problem hiding this comment.
User ID passed as int instead of string
Medium Severity
The id field from identity_user.id is an int, but sentry_sdk.set_user expects a string for user.id. This type mismatch can prevent the user.id attribute from being indexed or searchable correctly in EAP, as downstream storage expects a string.
Reviewed by Cursor Bugbot for commit bbc6237. Configure here.
DominikB2014
added a commit
that referenced
this pull request
Apr 8, 2026
Follow-up to #112530. `sentry_sdk.set_user` expects a string for the `id` field. The previous PR passed `identity_user.id` as an int, which can prevent `user.id` from being indexed correctly in EAP spans. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
Replace `set_tag("user.email", ...)` with `set_user({"email": ...})` so
the
user email is properly stored as `sentry.user.email` in span attributes,
matching the EAP search attribute definition. Previously, `user.email`
was
never populated for spans with `slack.event_type` because the tag key
didn't
match the expected internal attribute name.
Also add a few other fields to user
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
Follow-up to #112530. `sentry_sdk.set_user` expects a string for the `id` field. The previous PR passed `identity_user.id` as an int, which can prevent `user.id` from being indexed correctly in EAP spans. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Replace
set_tag("user.email", ...)withset_user({"id", "email", "username"})in the Slack event webhook'son_link_sharedhandler.Previously,
user.emailwas set viaset_tag("user.email", ...)which stored it under the wrong attribute key, causinguser.emailto never appear in EAP span queries for spans withslack.event_type. Usingset_user()stores the values under the correctsentry.user.*attributes that match the EAP search definitions. Also addsuser.id(as string) anduser.usernameto enrich the user context.