Skip to content

Commit 0fe7370

Browse files
authored
Merge branch 'develop' into esm/again
2 parents 1945f73 + 4b261ce commit 0fe7370

File tree

10 files changed

+24
-91
lines changed

10 files changed

+24
-91
lines changed

dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ sentryTest(
2929
expect(eventData.measurements).toBeDefined();
3030
expect(eventData.measurements?.lcp?.value).toBeDefined();
3131

32-
expect(eventData.tags?.['lcp.element']).toBe('body > img');
33-
expect(eventData.tags?.['lcp.size']).toBe(107400);
34-
expect(eventData.tags?.['lcp.url']).toBe('https://example.com/path/to/image.png');
32+
expect(eventData.contexts?.trace?.data?.['lcp.element']).toBe('body > img');
33+
expect(eventData.contexts?.trace?.data?.['lcp.size']).toBe(107400);
34+
expect(eventData.contexts?.trace?.data?.['lcp.url']).toBe('https://example.com/path/to/image.png');
3535

3636
const lcp = await (await page.waitForFunction('window._LCP')).jsonValue();
3737
const lcp2 = await (await page.waitForFunction('window._LCP2')).jsonValue();

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sentryTest('should capture a "GOOD" CLS vital with its source(s).', async ({ get
2323
expect(eventData.measurements?.cls?.value).toBeGreaterThan(0.03);
2424
expect(eventData.measurements?.cls?.value).toBeLessThan(0.07);
2525

26-
expect(eventData.tags?.['cls.source.1']).toBe('body > div#content > p#partial');
26+
expect(eventData.contexts?.trace?.data?.['cls.source.1']).toBe('body > div#content > p#partial');
2727
});
2828

2929
sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getLocalTestPath, page }) => {
@@ -37,7 +37,7 @@ sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getL
3737
expect(eventData.measurements?.cls?.value).toBeGreaterThan(0.18);
3838
expect(eventData.measurements?.cls?.value).toBeLessThan(0.23);
3939

40-
expect(eventData.tags?.['cls.source.1']).toBe('body > div#content > p');
40+
expect(eventData.contexts?.trace?.data?.['cls.source.1']).toBe('body > div#content > p');
4141
});
4242

4343
sentryTest('should capture a "POOR" CLS vital with its source(s).', async ({ getLocalTestPath, page }) => {
@@ -50,5 +50,5 @@ sentryTest('should capture a "POOR" CLS vital with its source(s).', async ({ get
5050
// Flakey value dependent on timings -> we check for a range
5151
expect(eventData.measurements?.cls?.value).toBeGreaterThan(0.34);
5252
expect(eventData.measurements?.cls?.value).toBeLessThan(0.36);
53-
expect(eventData.tags?.['cls.source.1']).toBe('body > div#content > p');
53+
expect(eventData.contexts?.trace?.data?.['cls.source.1']).toBe('body > div#content > p');
5454
});

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ sentryTest('should capture a LCP vital with element details.', async ({ browserN
1010
sentryTest.skip();
1111
}
1212

13-
await page.route('**/path/to/image.png', (route: Route) =>
14-
route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` }),
15-
);
13+
page.route('**', route => route.continue());
14+
page.route('**/path/to/image.png', async (route: Route) => {
15+
return route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` });
16+
});
1617

1718
const url = await getLocalTestPath({ testDir: __dirname });
1819
const [eventData] = await Promise.all([
@@ -24,7 +25,7 @@ sentryTest('should capture a LCP vital with element details.', async ({ browserN
2425
expect(eventData.measurements).toBeDefined();
2526
expect(eventData.measurements?.lcp?.value).toBeDefined();
2627

27-
expect(eventData.tags?.['lcp.element']).toBe('body > img');
28-
expect(eventData.tags?.['lcp.size']).toBe(107400);
29-
expect(eventData.tags?.['lcp.url']).toBe('https://example.com/path/to/image.png');
28+
expect(eventData.contexts?.trace?.data?.['lcp.element']).toBe('body > img');
29+
expect(eventData.contexts?.trace?.data?.['lcp.size']).toBe(107400);
30+
expect(eventData.contexts?.trace?.data?.['lcp.url']).toBe('https://example.com/path/to/image.png');
3031
});

packages/core/src/tracing/sentrySpan.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type {
2-
Primitive,
32
Span,
43
SpanAttributeValue,
54
SpanAttributes,
@@ -65,12 +64,6 @@ export class SpanRecorder {
6564
* Span contains all data about a span
6665
*/
6766
export class SentrySpan implements Span {
68-
/**
69-
* Tags for the span.
70-
* @deprecated Use `spanToJSON(span).atttributes` instead.
71-
*/
72-
public tags: { [key: string]: Primitive };
73-
7467
/**
7568
* Data for the span.
7669
* @deprecated Use `spanToJSON(span).atttributes` instead.
@@ -117,8 +110,6 @@ export class SentrySpan implements Span {
117110
this._spanId = spanContext.spanId || uuid4().substring(16);
118111
this._startTime = spanContext.startTimestamp || timestampInSeconds();
119112
// eslint-disable-next-line deprecation/deprecation
120-
this.tags = spanContext.tags ? { ...spanContext.tags } : {};
121-
// eslint-disable-next-line deprecation/deprecation
122113
this.data = spanContext.data ? { ...spanContext.data } : {};
123114

124115
this._attributes = {};
@@ -328,21 +319,6 @@ export class SentrySpan implements Span {
328319
return childSpan;
329320
}
330321

331-
/**
332-
* Sets the tag attribute on the current span.
333-
*
334-
* Can also be used to unset a tag, by passing `undefined`.
335-
*
336-
* @param key Tag key
337-
* @param value Tag value
338-
* @deprecated Use `setAttribute()` instead.
339-
*/
340-
public setTag(key: string, value: Primitive): this {
341-
// eslint-disable-next-line deprecation/deprecation
342-
this.tags = { ...this.tags, [key]: value };
343-
return this;
344-
}
345-
346322
/**
347323
* Sets the data attribute on the current span
348324
* @param key Data key
@@ -439,8 +415,6 @@ export class SentrySpan implements Span {
439415
spanId: this._spanId,
440416
startTimestamp: this._startTime,
441417
status: this._status,
442-
// eslint-disable-next-line deprecation/deprecation
443-
tags: this.tags,
444418
traceId: this._traceId,
445419
});
446420
}
@@ -471,8 +445,6 @@ export class SentrySpan implements Span {
471445
span_id: this._spanId,
472446
start_timestamp: this._startTime,
473447
status: getStatusMessage(this._status),
474-
// eslint-disable-next-line deprecation/deprecation
475-
tags: Object.keys(this.tags).length > 0 ? this.tags : undefined,
476448
timestamp: this._endTime,
477449
trace_id: this._traceId,
478450
origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined,

packages/core/src/tracing/transaction.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
286286
},
287287
spans,
288288
start_timestamp: this._startTime,
289-
// eslint-disable-next-line deprecation/deprecation
290-
tags: this.tags,
291289
timestamp: this._endTime,
292290
transaction: this._name,
293291
type: 'transaction',

packages/core/src/utils/spanUtils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ export const TRACE_FLAG_SAMPLED = 0x1;
2222
*/
2323
export function spanToTraceContext(span: Span): TraceContext {
2424
const { spanId: span_id, traceId: trace_id } = span.spanContext();
25-
const { data, op, parent_span_id, status, tags, origin } = spanToJSON(span);
25+
const { data, op, parent_span_id, status, origin } = spanToJSON(span);
2626

2727
return dropUndefinedKeys({
2828
data,
2929
op,
3030
parent_span_id,
3131
span_id,
3232
status,
33-
tags,
3433
trace_id,
3534
origin,
3635
});

packages/profiling-node/test/hubextensions.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { __PRIVATE__wrapStartTransactionWithProfiling } from '../src/hubextensio
1515
function makeTransactionMock(options = {}): Transaction {
1616
return {
1717
metadata: {},
18-
tags: {},
1918
sampled: true,
2019
contexts: {},
2120
startChild: () => ({ end: () => void 0 }),
@@ -29,10 +28,6 @@ function makeTransactionMock(options = {}): Transaction {
2928
// @ts-expect-error - contexts is private
3029
this.contexts[key] = context;
3130
},
32-
setTag(this: Transaction, key: string, value: any) {
33-
// eslint-disable-next-line deprecation/deprecation
34-
this.tags[key] = value;
35-
},
3631
setMetadata(this: Transaction, metadata: Partial<TransactionMetadata>) {
3732
// eslint-disable-next-line deprecation/deprecation
3833
this.metadata = { ...metadata } as TransactionMetadata;

packages/tracing-internal/src/browser/metrics/index.ts

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable max-lines */
2-
import type { SentrySpan } from '@sentry/core';
32
import { getActiveSpan, startInactiveSpan } from '@sentry/core';
43
import { setMeasurement } from '@sentry/core';
54
import type { Measurements, Span, StartSpanOptions } from '@sentry/types';
@@ -445,15 +444,11 @@ function _trackNavigator(span: Span): void {
445444
const connection = navigator.connection;
446445
if (connection) {
447446
if (connection.effectiveType) {
448-
// TODO: Can we rewrite this to an attribute?
449-
// eslint-disable-next-line deprecation/deprecation
450-
(span as SentrySpan).setTag('effectiveConnectionType', connection.effectiveType);
447+
span.setAttribute('effectiveConnectionType', connection.effectiveType);
451448
}
452449

453450
if (connection.type) {
454-
// TODO: Can we rewrite this to an attribute?
455-
// eslint-disable-next-line deprecation/deprecation
456-
(span as SentrySpan).setTag('connectionType', connection.type);
451+
span.setAttribute('connectionType', connection.type);
457452
}
458453

459454
if (isMeasurementValue(connection.rtt)) {
@@ -462,15 +457,11 @@ function _trackNavigator(span: Span): void {
462457
}
463458

464459
if (isMeasurementValue(navigator.deviceMemory)) {
465-
// TODO: Can we rewrite this to an attribute?
466-
// eslint-disable-next-line deprecation/deprecation
467-
(span as SentrySpan).setTag('deviceMemory', `${navigator.deviceMemory} GB`);
460+
span.setAttribute('deviceMemory', `${navigator.deviceMemory} GB`);
468461
}
469462

470463
if (isMeasurementValue(navigator.hardwareConcurrency)) {
471-
// TODO: Can we rewrite this to an attribute?
472-
// eslint-disable-next-line deprecation/deprecation
473-
(span as SentrySpan).setTag('hardwareConcurrency', String(navigator.hardwareConcurrency));
464+
span.setAttribute('hardwareConcurrency', String(navigator.hardwareConcurrency));
474465
}
475466
}
476467

@@ -482,36 +473,26 @@ function _tagMetricInfo(span: Span): void {
482473
// Capture Properties of the LCP element that contributes to the LCP.
483474

484475
if (_lcpEntry.element) {
485-
// TODO: Can we rewrite this to an attribute?
486-
// eslint-disable-next-line deprecation/deprecation
487-
(span as SentrySpan).setTag('lcp.element', htmlTreeAsString(_lcpEntry.element));
476+
span.setAttribute('lcp.element', htmlTreeAsString(_lcpEntry.element));
488477
}
489478

490479
if (_lcpEntry.id) {
491-
// TODO: Can we rewrite this to an attribute?
492-
// eslint-disable-next-line deprecation/deprecation
493-
(span as SentrySpan).setTag('lcp.id', _lcpEntry.id);
480+
span.setAttribute('lcp.id', _lcpEntry.id);
494481
}
495482

496483
if (_lcpEntry.url) {
497484
// Trim URL to the first 200 characters.
498-
// TODO: Can we rewrite this to an attribute?
499-
// eslint-disable-next-line deprecation/deprecation
500-
(span as SentrySpan).setTag('lcp.url', _lcpEntry.url.trim().slice(0, 200));
485+
span.setAttribute('lcp.url', _lcpEntry.url.trim().slice(0, 200));
501486
}
502487

503-
// TODO: Can we rewrite this to an attribute?
504-
// eslint-disable-next-line deprecation/deprecation
505-
(span as SentrySpan).setTag('lcp.size', _lcpEntry.size);
488+
span.setAttribute('lcp.size', _lcpEntry.size);
506489
}
507490

508491
// See: https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift
509492
if (_clsEntry && _clsEntry.sources) {
510493
DEBUG_BUILD && logger.log('[Measurements] Adding CLS Data');
511494
_clsEntry.sources.forEach((source, index) =>
512-
// TODO: Can we rewrite this to an attribute?
513-
// eslint-disable-next-line deprecation/deprecation
514-
(span as SentrySpan).setTag(`cls.source.${index + 1}`, htmlTreeAsString(source.node)),
495+
span.setAttribute(`cls.source.${index + 1}`, htmlTreeAsString(source.node)),
515496
);
516497
}
517498
}

packages/types/src/span.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export interface SpanJSON {
5050
span_id: string;
5151
start_timestamp: number;
5252
status?: string;
53-
tags?: { [key: string]: Primitive };
5453
timestamp?: number;
5554
trace_id: string;
5655
origin?: SpanOrigin;
@@ -132,12 +131,6 @@ export interface SpanContext {
132131
*/
133132
traceId?: string | undefined;
134133

135-
/**
136-
* Tags of the Span.
137-
* @deprecated Pass `attributes` instead.
138-
*/
139-
tags?: { [key: string]: Primitive };
140-
141134
/**
142135
* Data of the Span.
143136
* @deprecated Pass `attributes` instead.

packages/types/src/transaction.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Context } from './context';
22
import type { DynamicSamplingContext } from './envelope';
33
import type { MeasurementUnit } from './measurement';
4-
import type { ExtractedNodeRequestData, Primitive, WorkerLocation } from './misc';
4+
import type { ExtractedNodeRequestData, WorkerLocation } from './misc';
55
import type { PolymorphicRequest } from './polymorphics';
66
import type { Span, SpanAttributes, SpanContext } from './span';
77

@@ -81,12 +81,6 @@ export interface Transaction extends Omit<TransactionContext, 'name' | 'op'>, Sp
8181
*/
8282
startTimestamp: number;
8383

84-
/**
85-
* Tags for the transaction.
86-
* @deprecated Use `getSpanAttributes(transaction)` instead.
87-
*/
88-
tags: { [key: string]: Primitive };
89-
9084
/**
9185
* Data for the transaction.
9286
* @deprecated Use `getSpanAttributes(transaction)` instead.

0 commit comments

Comments
 (0)