Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions skills/sentry-svelte-sdk/references/error-monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ Sentry.setTags({

Key constraints: ≤32 chars, alphanumeric + `_`, `.`, `:`, `-`. Value: ≤200 chars, no newlines.

### Attributes (applied to logs, metrics, and spans)

```typescript
Sentry.setAttribute("is_admin", true);
Sentry.setAttribute("render_duration", 150);
Sentry.setAttributes({
is_admin: true,
payment_selection: "credit_card",
render_duration: 150,
});
```

Attributes are applied to logs, metrics, and streamed spans. Supported types: `string`, `number`, `boolean`, and arrays of these types (`string[]`, `number[]`, `boolean[]`).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The documentation for Sentry.setAttribute() incorrectly claims it supports array values. These APIs write to the scope, which only supports primitive types, not arrays.
Severity: MEDIUM

Suggested Fix

Update the documentation for Sentry.setAttribute() and Sentry.setAttributes() to remove arrays from the list of supported types. Clarify that only string, number, and boolean are supported for scope-level attributes, and that arrays are only valid when set directly on a span.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: skills/sentry-svelte-sdk/references/error-monitoring.md#L166

Potential issue: The documentation for `Sentry.setAttribute()` and
`Sentry.setAttributes()` in `error-monitoring.md` incorrectly states that these
functions support array values. These functions write to the isolation scope, which,
according to other Sentry documentation for scope attributes (`logging.md`), only
supports primitive types (`string`, `number`, `boolean`). While span-specific attributes
can be arrays, scope-level attributes cannot. Users following this new documentation
will attempt to use arrays, which will likely result in the data being silently dropped
or causing an error, leading to incorrect telemetry.

Did we get this right? 👍 / 👎 to inform future reviews.


### Context Objects (structured, non-indexed)

```typescript
Expand Down