diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index cf74f24e542d..fc7e871df53f 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -8,8 +8,6 @@ import type { SpanOrigin, SpanStatus, SpanTimeInput, - TraceContext, - Transaction, } from '@sentry/types'; import { dropUndefinedKeys, logger, timestampInSeconds, uuid4 } from '@sentry/utils'; import { getClient } from '../currentScopes'; @@ -25,18 +23,12 @@ import { getStatusMessage, spanTimeInputToSeconds, spanToJSON, - spanToTraceContext, } from '../utils/spanUtils'; /** * Span contains all data about a span */ export class SentrySpan implements Span { - /** - * @inheritDoc - * @deprecated Use top level `Sentry.getRootSpan()` instead - */ - public transaction?: Transaction; protected _traceId: string; protected _spanId: string; protected _parentSpanId?: string | undefined; @@ -85,43 +77,6 @@ export class SentrySpan implements Span { } } - // This rule conflicts with another eslint rule :( - /* eslint-disable @typescript-eslint/member-ordering */ - - /** - * Timestamp in seconds (epoch time) indicating when the span started. - * @deprecated Use `spanToJSON()` instead. - */ - public get startTimestamp(): number { - return this._startTime; - } - - /** - * Timestamp in seconds (epoch time) indicating when the span started. - * @deprecated In v8, you will not be able to update the span start time after creation. - */ - public set startTimestamp(startTime: number) { - this._startTime = startTime; - } - - /** - * Timestamp in seconds when the span ended. - * @deprecated Use `spanToJSON()` instead. - */ - public get endTimestamp(): number | undefined { - return this._endTime; - } - - /** - * Timestamp in seconds when the span ended. - * @deprecated Set the end time via `span.end()` instead. - */ - public set endTimestamp(endTime: number | undefined) { - this._endTime = endTime; - } - - /* eslint-enable @typescript-eslint/member-ordering */ - /** @inheritdoc */ public spanContext(): SpanContextData { const { _spanId: spanId, _traceId: traceId, _sampled: sampled } = this; @@ -157,10 +112,6 @@ export class SentrySpan implements Span { addChildSpanToSpan(this, childSpan); const rootSpan = getRootSpan(this); - // TODO: still set span.transaction here until we have a more permanent solution - // Probably similarly to the weakmap we hold in node - // eslint-disable-next-line deprecation/deprecation - childSpan.transaction = rootSpan as Transaction; if (DEBUG_BUILD && rootSpan) { const opStr = (spanContext && spanContext.op) || '< unknown op >'; @@ -251,35 +202,6 @@ export class SentrySpan implements Span { this._onSpanEnded(); } - /** - * @inheritDoc - * - * @deprecated Use `spanToJSON()` or access the fields directly instead. - */ - public toContext(): SentrySpanArguments { - return dropUndefinedKeys({ - data: this._attributes, - name: this._name, - endTimestamp: this._endTime, - op: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], - parentSpanId: this._parentSpanId, - sampled: this._sampled, - spanId: this._spanId, - startTimestamp: this._startTime, - status: this._status, - traceId: this._traceId, - }); - } - - /** - * @inheritDoc - * - * @deprecated Use `spanToTraceContext()` util function instead. - */ - public getTraceContext(): TraceContext { - return spanToTraceContext(this); - } - /** * Get JSON representation of this span. * @@ -309,14 +231,6 @@ export class SentrySpan implements Span { return !this._endTime && !!this._sampled; } - /** - * Convert the object to JSON. - * @deprecated Use `spanToJSON(span)` instead. - */ - public toJSON(): SpanJSON { - return this.getSpanJSON(); - } - /** Emit `spanEnd` when the span is ended. */ private _onSpanEnded(): void { const client = getClient(); diff --git a/packages/core/src/tracing/transaction.ts b/packages/core/src/tracing/transaction.ts index ae1676694c34..4f943c856f86 100644 --- a/packages/core/src/tracing/transaction.ts +++ b/packages/core/src/tracing/transaction.ts @@ -1,5 +1,4 @@ import type { - Context, Contexts, DynamicSamplingContext, Hub, @@ -74,11 +73,6 @@ export class Transaction extends SentrySpan implements TransactionInterface { ...this._attributes, }; - // this is because transactions are also spans, and spans have a transaction pointer - // TODO (v8): Replace this with another way to set the root span - // eslint-disable-next-line deprecation/deprecation - this.transaction = this; - // If Dynamic Sampling Context is provided during the creation of the transaction, we freeze it as it usually means // there is incoming Dynamic Sampling Context. (Either through an incoming request, a baggage meta-tag, or other means) const incomingDynamicSamplingContext = this._metadata.dynamicSamplingContext; @@ -124,19 +118,6 @@ export class Transaction extends SentrySpan implements TransactionInterface { return this; } - /** - * Set the context of a transaction event. - * @deprecated Use either `.setAttribute()`, or set the context on the scope before creating the transaction. - */ - public setContext(key: string, context: Context | null): void { - if (context === null) { - // eslint-disable-next-line @typescript-eslint/no-dynamic-delete - delete this._contexts[key]; - } else { - this._contexts[key] = context; - } - } - /** * @inheritDoc * @@ -167,41 +148,6 @@ export class Transaction extends SentrySpan implements TransactionInterface { return this._hub.captureEvent(transaction); } - /** - * @inheritDoc - */ - public toContext(): TransactionArguments { - // eslint-disable-next-line deprecation/deprecation - const spanContext = super.toContext(); - - return dropUndefinedKeys({ - ...spanContext, - name: this._name, - trimEnd: this._trimEnd, - }); - } - - /** - * @inheritdoc - * - * @experimental - * - * @deprecated Use top-level `getDynamicSamplingContextFromSpan` instead. - */ - public getDynamicSamplingContext(): Readonly> { - return getDynamicSamplingContextFromSpan(this); - } - - /** - * Override the current hub with a new one. - * Used if you want another hub to finish the transaction. - * - * @internal - */ - public setHub(hub: Hub): void { - this._hub = hub; - } - /** * Finish the transaction & prepare the event to send to Sentry. */ diff --git a/packages/types/src/transaction.ts b/packages/types/src/transaction.ts index 227a314b0f08..10f090ae109f 100644 --- a/packages/types/src/transaction.ts +++ b/packages/types/src/transaction.ts @@ -1,4 +1,3 @@ -import type { Context } from './context'; import type { DynamicSamplingContext } from './envelope'; import type { MeasurementUnit } from './measurement'; import type { ExtractedNodeRequestData, WorkerLocation } from './misc'; @@ -58,23 +57,12 @@ export interface TraceparentData { * Transaction "Class", inherits Span only has `setName` */ export interface Transaction extends Omit, Span { - /** - * @inheritDoc - */ - startTimestamp: number; - /** * Metadata about the transaction. * @deprecated Use attributes or store data on the scope instead. */ metadata: TransactionMetadata; - /** - * Set the context of a transaction event. - * @deprecated Use either `.setAttribute()`, or set the context on the scope before creating the transaction. - */ - setContext(key: string, context: Context): void; - /** * Set observed measurement for this transaction. * @@ -86,25 +74,12 @@ export interface Transaction extends Omit): void; - /** - * Return the current Dynamic Sampling Context of this transaction - * - * @deprecated Use top-level `getDynamicSamplingContextFromSpan` instead. - */ - getDynamicSamplingContext(): Partial; - /** * Creates a new `Span` while setting the current `Span.id` as `parentSpanId`. * Also the `sampled` decision will be inherited.