Skip to content

feat: Remove tags from spans & transactions #10809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
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
28 changes: 0 additions & 28 deletions packages/core/src/tracing/sentrySpan.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {
Primitive,
Span,
SpanAttributeValue,
SpanAttributes,
Expand Down Expand Up @@ -65,12 +64,6 @@ export class SpanRecorder {
* Span contains all data about a span
*/
export class SentrySpan implements Span {
/**
* Tags for the span.
* @deprecated Use `spanToJSON(span).atttributes` instead.
*/
public tags: { [key: string]: Primitive };

/**
* Data for the span.
* @deprecated Use `spanToJSON(span).atttributes` instead.
Expand Down Expand Up @@ -117,8 +110,6 @@ export class SentrySpan implements Span {
this._spanId = spanContext.spanId || uuid4().substring(16);
this._startTime = spanContext.startTimestamp || timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this.tags = spanContext.tags ? { ...spanContext.tags } : {};
// eslint-disable-next-line deprecation/deprecation
this.data = spanContext.data ? { ...spanContext.data } : {};

this._attributes = {};
Expand Down Expand Up @@ -328,21 +319,6 @@ export class SentrySpan implements Span {
return childSpan;
}

/**
* Sets the tag attribute on the current span.
*
* Can also be used to unset a tag, by passing `undefined`.
*
* @param key Tag key
* @param value Tag value
* @deprecated Use `setAttribute()` instead.
*/
public setTag(key: string, value: Primitive): this {
// eslint-disable-next-line deprecation/deprecation
this.tags = { ...this.tags, [key]: value };
return this;
}

/**
* Sets the data attribute on the current span
* @param key Data key
Expand Down Expand Up @@ -439,8 +415,6 @@ export class SentrySpan implements Span {
spanId: this._spanId,
startTimestamp: this._startTime,
status: this._status,
// eslint-disable-next-line deprecation/deprecation
tags: this.tags,
traceId: this._traceId,
});
}
Expand Down Expand Up @@ -471,8 +445,6 @@ export class SentrySpan implements Span {
span_id: this._spanId,
start_timestamp: this._startTime,
status: getStatusMessage(this._status),
// eslint-disable-next-line deprecation/deprecation
tags: Object.keys(this.tags).length > 0 ? this.tags : undefined,
timestamp: this._endTime,
trace_id: this._traceId,
origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined,
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/tracing/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
},
spans,
start_timestamp: this._startTime,
// eslint-disable-next-line deprecation/deprecation
tags: this.tags,
timestamp: this._endTime,
transaction: this._name,
type: 'transaction',
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/utils/spanUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ export const TRACE_FLAG_SAMPLED = 0x1;
*/
export function spanToTraceContext(span: Span): TraceContext {
const { spanId: span_id, traceId: trace_id } = span.spanContext();
const { data, op, parent_span_id, status, tags, origin } = spanToJSON(span);
const { data, op, parent_span_id, status, origin } = spanToJSON(span);

return dropUndefinedKeys({
data,
op,
parent_span_id,
span_id,
status,
tags,
trace_id,
origin,
});
Expand Down
5 changes: 0 additions & 5 deletions packages/profiling-node/test/hubextensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { __PRIVATE__wrapStartTransactionWithProfiling } from '../src/hubextensio
function makeTransactionMock(options = {}): Transaction {
return {
metadata: {},
tags: {},
sampled: true,
contexts: {},
startChild: () => ({ end: () => void 0 }),
Expand All @@ -29,10 +28,6 @@ function makeTransactionMock(options = {}): Transaction {
// @ts-expect-error - contexts is private
this.contexts[key] = context;
},
setTag(this: Transaction, key: string, value: any) {
// eslint-disable-next-line deprecation/deprecation
this.tags[key] = value;
},
setMetadata(this: Transaction, metadata: Partial<TransactionMetadata>) {
// eslint-disable-next-line deprecation/deprecation
this.metadata = { ...metadata } as TransactionMetadata;
Expand Down
7 changes: 0 additions & 7 deletions packages/types/src/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export interface SpanJSON {
span_id: string;
start_timestamp: number;
status?: string;
tags?: { [key: string]: Primitive };
timestamp?: number;
trace_id: string;
origin?: SpanOrigin;
Expand Down Expand Up @@ -132,12 +131,6 @@ export interface SpanContext {
*/
traceId?: string | undefined;

/**
* Tags of the Span.
* @deprecated Pass `attributes` instead.
*/
tags?: { [key: string]: Primitive };

/**
* Data of the Span.
* @deprecated Pass `attributes` instead.
Expand Down
8 changes: 1 addition & 7 deletions packages/types/src/transaction.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Context } from './context';
import type { DynamicSamplingContext } from './envelope';
import type { MeasurementUnit } from './measurement';
import type { ExtractedNodeRequestData, Primitive, WorkerLocation } from './misc';
import type { ExtractedNodeRequestData, WorkerLocation } from './misc';
import type { PolymorphicRequest } from './polymorphics';
import type { Span, SpanAttributes, SpanContext } from './span';

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

/**
* Tags for the transaction.
* @deprecated Use `getSpanAttributes(transaction)` instead.
*/
tags: { [key: string]: Primitive };

/**
* Data for the transaction.
* @deprecated Use `getSpanAttributes(transaction)` instead.
Expand Down