From 093013626ef2cd68e1b2f4dd4c8213e163679a8c Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Fri, 12 Jan 2024 12:10:58 +0100 Subject: [PATCH] feat(core): Deprecase remaining `setName` declarations on `Transaction` and `Span` --- MIGRATION.md | 5 +++-- packages/core/src/tracing/span.ts | 6 +++++- packages/core/src/tracing/transaction.ts | 2 +- packages/types/src/transaction.ts | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index fe0336d2d1f6..7939e24792c0 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -151,15 +151,16 @@ In v8, the Span class is heavily reworked. The following properties & methods ar - `span.name`: Use `spanToJSON(span).description` instead. - `span.description`: Use `spanToJSON(span).description` instead. - `span.getDynamicSamplingContext`: Use `getDynamicSamplingContextFromSpan` utility function instead. -- `transaction.setMetadata()`: Use attributes instead, or set data on the scope. -- `transaction.metadata`: Use attributes instead, or set data on the scope. - `span.tags`: Set tags on the surrounding scope instead, or use attributes. - `span.data`: Use `spanToJSON(span).data` instead. - `span.setTag()`: Use `span.setAttribute()` instead or set tags on the surrounding scope. - `span.setData()`: Use `span.setAttribute()` instead. - `span.instrumenter` This field was removed and will be replaced internally. - `span.transaction`: Use `getRootSpan` utility function instead. +- `transaction.setMetadata()`: Use attributes instead, or set data on the scope. +- `transaction.metadata`: Use attributes instead, or set data on the scope. - `transaction.setContext()`: Set context on the surrounding scope instead. +- `transaction.setName()`: Set the name with `.updateName()` and the source with `.setAttribute()` instead. ## Deprecate `pushScope` & `popScope` in favor of `withScope` diff --git a/packages/core/src/tracing/span.ts b/packages/core/src/tracing/span.ts index 170f2d4b60be..129f6358c671 100644 --- a/packages/core/src/tracing/span.ts +++ b/packages/core/src/tracing/span.ts @@ -391,7 +391,11 @@ export class Span implements SpanInterface { return this; } - /** @inheritdoc */ + /** + * @inheritdoc + * + * @deprecated Use `.updateName()` instead. + */ public setName(name: string): void { this.updateName(name); } diff --git a/packages/core/src/tracing/transaction.ts b/packages/core/src/tracing/transaction.ts index 90d2c1ad4a92..aca140532fa2 100644 --- a/packages/core/src/tracing/transaction.ts +++ b/packages/core/src/tracing/transaction.ts @@ -137,7 +137,7 @@ export class Transaction extends SpanClass implements TransactionInterface { /** * Setter for `name` property, which also sets `source` on the metadata. * - * @deprecated Use `updateName()` and `setMetadata()` instead. + * @deprecated Use `.updateName()` and `.setAttribute()` instead. */ public setName(name: string, source: TransactionMetadata['source'] = 'custom'): void { this._name = name; diff --git a/packages/types/src/transaction.ts b/packages/types/src/transaction.ts index 05be3c588c06..5c29da7d2f45 100644 --- a/packages/types/src/transaction.ts +++ b/packages/types/src/transaction.ts @@ -104,6 +104,8 @@ export interface Transaction extends TransactionContext, Omit