Skip to content

Commit fdeba11

Browse files
nicohrubecclaude
andauthored
ref(browser): Use safeSetSpanJSONAttributes in cultureContext integration (#20481)
Applies the same `safeSetSpanJSONAttributes` refactor from #20464 to the `cultureContext` integration's `processSegmentSpan` hook. This gives us in-place mutation instead of spread-and-reassign and nullish values are skipped (these get dropped during serialization anyways but doesn't hurt to just not assign them in the first place). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e2d35a2 commit fdeba11

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/browser/src/integrations/culturecontext.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { CultureContext, IntegrationFn } from '@sentry/core';
2-
import { defineIntegration } from '@sentry/core';
2+
import { defineIntegration, safeSetSpanJSONAttributes } from '@sentry/core';
33
import { WINDOW } from '../helpers';
44

55
const INTEGRATION_NAME = 'CultureContext';
@@ -21,12 +21,11 @@ const _cultureContextIntegration = (() => {
2121
const culture = getCultureContext();
2222

2323
if (culture) {
24-
span.attributes = {
24+
safeSetSpanJSONAttributes(span, {
2525
'culture.locale': culture.locale,
2626
'culture.timezone': culture.timezone,
2727
'culture.calendar': culture.calendar,
28-
...span.attributes,
29-
};
28+
});
3029
}
3130
},
3231
};

0 commit comments

Comments
 (0)