Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user locale info to device context #4798

Open
lhunath opened this issue Feb 5, 2025 · 6 comments
Open

Add user locale info to device context #4798

lhunath opened this issue Feb 5, 2025 · 6 comments

Comments

@lhunath
Copy link
Contributor

lhunath commented Feb 5, 2025

Problem Statement

Understanding the user demographics of certain issues can be relevant and useful information.

Solution Brainstorm

Sentry could expose a standard set of tags automatically added to events to describe demographic metrics which are made available by the system directly, such as Calendar, TimeZone and Locale. Other candidates might be: Storefront, UITraitCollection, TermOfAddress, AccessibilityRequest.

eg.

scope.setTag(value: Locale.current.identifier, key: "user.locale")
scope.setTag(value: TimeZone.current.identifier, key: "user.zone")
scope.setTag(value: Calendar.current.identifier.debugDescription, key: "user.calendar")
scope.setTag(value: Calendar.current.standaloneWeekdaySymbols[Calendar.current.firstWeekday - 1], key: "user.week_start")
scope.setTag(value: AccessibilityRequest.current?.technology.rawValue ?? "none", key: "user.accessibility")
scope.setTag(value: TermOfAddress.currentUser.pronouns.map(\.pronoun).joined(separator: ","), key: "user.pronouns")

Are you willing to submit a PR?

No response

@philprime
Copy link
Contributor

Hi @lhunath, thanks for opening this feature request.

Is there a specific reason why these values should be added by default, instead of allowing SDK users to set them on demand?

@lhunath
Copy link
Contributor Author

lhunath commented Feb 5, 2025

Since they are platform-provided, that makes them standardized values available for all.
Standardizing the set of tags that reflect these values will help ensure consistency across the Sentry platform as well as surface these standards for demographic use within Sentry to users who might not have previously considered their value or availability, thereby augmenting the inherent value provided by the Sentry product.
Whatever the rationale is for providing the current UIDevice values in standardized tags can be applied to these as well in order to evaluate their inclusion.

@philipphofmann philipphofmann changed the title Add standard tags for user locale Add user locale info to device context Feb 5, 2025
@philipphofmann
Copy link
Member

We can add such information out of the box, but we must not add them as tags, because they are expensive to handle on the backend for us. Instead, we should add such info to the device or user context. If we want that to be searchable, we need to follow up on the backend to make these fields searchable.

@lhunath
Copy link
Contributor Author

lhunath commented Feb 5, 2025

Thanks @philipphofmann! Is there some documentation I can consult to evaluate the costs and implications of tags vs. contexts?

Thus far, my evaluation determining tag vs. context has been:

  1. Do I want to be able to search for it?
  2. Do I want to be able to evaluate value breakdowns?

On these counts, demographic values seem to be a 2x yes, though I can of course appreciate your performance considerations, which no doubt have been part of the equation for the existing set of tags as well.

@philipphofmann
Copy link
Member

@lhunath, you, as a user, can safely use tags for this. We don't want to add tags per default via the SDK for everybody. Adding common searchable properties for all users via the context and indexing them so they're searchable is cheaper for us.

@lhunath
Copy link
Contributor Author

lhunath commented Feb 6, 2025

We do miss the breakdown which is a central element in demographics, but I will let the Sentry team assess internally and arrive at what is best 👍, thanks folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Discussion
Development

No branches or pull requests

3 participants