Skip to content

Commit 2171633

Browse files
authored
feat(core): Deprecate remaining setName declarations on Transaction and Span (#10164)
Seems like we didn't fully deprecate the `setName` API in #10018 as some deprecation annotations were still missing on * `Span` class * `Transaction` class * `Transaction` interface
1 parent 09559ee commit 2171633

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

MIGRATION.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,16 @@ In v8, the Span class is heavily reworked. The following properties & methods ar
151151
- `span.name`: Use `spanToJSON(span).description` instead.
152152
- `span.description`: Use `spanToJSON(span).description` instead.
153153
- `span.getDynamicSamplingContext`: Use `getDynamicSamplingContextFromSpan` utility function instead.
154-
- `transaction.setMetadata()`: Use attributes instead, or set data on the scope.
155-
- `transaction.metadata`: Use attributes instead, or set data on the scope.
156154
- `span.tags`: Set tags on the surrounding scope instead, or use attributes.
157155
- `span.data`: Use `spanToJSON(span).data` instead.
158156
- `span.setTag()`: Use `span.setAttribute()` instead or set tags on the surrounding scope.
159157
- `span.setData()`: Use `span.setAttribute()` instead.
160158
- `span.instrumenter` This field was removed and will be replaced internally.
161159
- `span.transaction`: Use `getRootSpan` utility function instead.
160+
- `transaction.setMetadata()`: Use attributes instead, or set data on the scope.
161+
- `transaction.metadata`: Use attributes instead, or set data on the scope.
162162
- `transaction.setContext()`: Set context on the surrounding scope instead.
163+
- `transaction.setName()`: Set the name with `.updateName()` and the source with `.setAttribute()` instead.
163164

164165
## Deprecate `pushScope` & `popScope` in favor of `withScope`
165166

packages/core/src/tracing/span.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,11 @@ export class Span implements SpanInterface {
391391
return this;
392392
}
393393

394-
/** @inheritdoc */
394+
/**
395+
* @inheritdoc
396+
*
397+
* @deprecated Use `.updateName()` instead.
398+
*/
395399
public setName(name: string): void {
396400
this.updateName(name);
397401
}

packages/core/src/tracing/transaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class Transaction extends SpanClass implements TransactionInterface {
137137
/**
138138
* Setter for `name` property, which also sets `source` on the metadata.
139139
*
140-
* @deprecated Use `updateName()` and `setMetadata()` instead.
140+
* @deprecated Use `.updateName()` and `.setAttribute()` instead.
141141
*/
142142
public setName(name: string, source: TransactionMetadata['source'] = 'custom'): void {
143143
this._name = name;

packages/types/src/transaction.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export interface Transaction extends TransactionContext, Omit<Span, 'setName' |
106106

107107
/**
108108
* Set the name of the transaction
109+
*
110+
* @deprecated Use `.updateName()` and `.setAttribute()` instead.
109111
*/
110112
setName(name: string, source?: TransactionMetadata['source']): void;
111113

0 commit comments

Comments
 (0)