Skip to content

Commit 809e0c7

Browse files
fix some type stuff
1 parent 9239638 commit 809e0c7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/core/src/tracing/span.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,12 @@ export class Span implements SpanInterface {
143143
this.instrumenter = spanContext.instrumenter || 'sentry';
144144

145145
this._attributes = {};
146+
const { measurements, ...attributes } = spanContext.attributes || {};
146147
this.setAttributes({
147148
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanContext.origin || 'manual',
148149
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op,
149-
...spanContext.attributes,
150+
[SEMANTIC_ATTRIBUTE_MEASUREMENTS]: measurements,
151+
...attributes,
150152
});
151153

152154
// eslint-disable-next-line deprecation/deprecation

packages/core/test/lib/tracing/span.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ describe('span', () => {
105105
it('disallows invalid attribute types', () => {
106106
const span = new Span();
107107

108-
/** @ts-expect-error this is invalid */
109-
span.setAttribute('str', {});
110-
111108
/** @ts-expect-error this is invalid */
112109
span.setAttribute('str', null);
113110

packages/types/src/span.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export type SpanAttributeValue =
2222
| boolean
2323
| Array<null | undefined | string>
2424
| Array<null | undefined | number>
25-
| Array<null | undefined | boolean>;
25+
| Array<null | undefined | boolean>
26+
| Measurements;
2627

2728
export type SpanAttributes = Partial<{
2829
'sentry.origin': string;

0 commit comments

Comments
 (0)