Skip to content

chore(changelog): clarify array attributes impact on beforeSend* callbacks#21186

Merged
nicohrubec merged 4 commits into
developfrom
feat/changelog-array-attributes-callout
May 28, 2026
Merged

chore(changelog): clarify array attributes impact on beforeSend* callbacks#21186
nicohrubec merged 4 commits into
developfrom
feat/changelog-array-attributes-callout

Conversation

@nicohrubec
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec commented May 27, 2026

The last release shipped array attribute support, which can subtly break user hooks if users have special treatment for these. Update the changelog to be a bit more explicit about this behavioral change.

Move the array attributes entry to the top of the 10.54.0 Important
Changes section and explicitly call out that beforeSend* callbacks
assuming primitive attribute values need to be updated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec changed the title docs: clarify array attributes impact on beforeSend callbacks chore(changelog): clarify array attributes impact on beforeSend* callbacks May 27, 2026
@nicohrubec nicohrubec marked this pull request as ready for review May 27, 2026 09:46
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated

- **feat(core): Support array attributes for spans, logs, and metrics ([#20427](https://github.com/getsentry/sentry-javascript/pull/20427))**

Arrays of primitive values (`string`, `number`, `boolean`) are now accepted as attribute values. Arrays containing non-primitive elements will be dropped and won't show up in Sentry. Array attributes on logs and metrics were previously stringified and will now be sent as actual arrays instead. **If you have custom rules that process attribute values in any `beforeSend*` callbacks (e.g., PII scrubbing), you may need to update them to correctly handle array values.**
Copy link
Copy Markdown
Member

@Lms24 Lms24 May 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add a code example here how to work with array attributes:

beforeSendLog: log => {
  const attributes = log.attributes;
  Object.keys(attributes).foreach(key => {
    const attributeValue = attributes[key];
    const attributeType = typeof attributeValue;

    if (attributeType === 'string') {
       attributes[key] = scrubDataFromString(attributeValue);
    } 
    if (attributeType === 'array') {
      attributes[key] = attributeValue.map(v => typeof v === 'string' ? scrubDataFromString(v) ? v);
    }
  })
}

nicohrubec and others added 2 commits May 28, 2026 13:09
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@nicohrubec nicohrubec merged commit 75fd1d5 into develop May 28, 2026
36 checks passed
@nicohrubec nicohrubec deleted the feat/changelog-array-attributes-callout branch May 28, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants