Skip to content

Add trace metric user attribute enrichment gated by send_default_pii in sentry-core #1060

@szokeasaurusrex

Description

@szokeasaurusrex

Split from #1024.

Add user attribute enrichment behavior in sentry-core so emitted metrics include selected user attributes only when send_default_pii is enabled, aligned with user attributes. Attach user.id, user.name, and user.email only when send_default_pii is true, and preserve explicitly set metric attributes instead of overwriting them. Focus on the relevant metric scope application code in sentry-core/src/scope/real.rs, sentry-core/src/scope/noop.rs, and sentry-core/src/client.rs. Add tests for user attributes omitted when send_default_pii is false, user attributes attached when send_default_pii is true, and explicitly set user.* metric attributes not overwritten by scope user data. Do not include tracing association, default attribute enrichment, or callback processing in this issue.

If code is reused from #997, include Co-authored-by: Joris Bayer <joris.bayer@sentry.io> in commit trailers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions