Skip to content

Commit 4b261ce

Browse files
authored
feat: Remove tags from spans & transactions (#10809)
We've refactored all usage away, now we can actually get rid of the tags on the span themselves.
1 parent c7c6bb2 commit 4b261ce

File tree

6 files changed

+2
-51
lines changed

6 files changed

+2
-51
lines changed

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/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)