Skip to content

Commit 307ec28

Browse files
authored
feat(core): Deprecate Span.instrumenter (#10139)
Deprecate the `instrumenter` field on the `Span` interface and class. The field is not part of the Otel Span API and hence it can't exist publicly on our spans either. We can replace field with an `instanceof` check when setting `instrumenter` on the event in v8. This is breaking though, so for now, we only deprecate it. Users shouldn't need to worry about this field anyway.
1 parent 840a307 commit 307ec28

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

MIGRATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ In v8, the Span class is heavily reworked. The following properties & methods ar
151151
- `span.data`: Use `spanToJSON(span).data` instead.
152152
- `span.setTag()`: Use `span.setAttribute()` instead or set tags on the surrounding scope.
153153
- `span.setData()`: Use `span.setAttribute()` instead.
154+
- `span.instrumenter` This field was removed and will be replaced internally.
154155
- `transaction.setContext()`: Set context on the surrounding scope instead.
155156

156157
## Deprecate `pushScope` & `popScope` in favor of `withScope`

packages/core/src/tracing/span.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ export class Span implements SpanInterface {
110110

111111
/**
112112
* The instrumenter that created this span.
113+
*
114+
* TODO (v8): This can probably be replaced by an `instanceOf` check of the span class.
115+
* the instrumenter can only be sentry or otel so we can check the span instance
116+
* to verify which one it is and remove this field entirely.
117+
*
118+
* @deprecated This field will be removed.
113119
*/
114120
public instrumenter: Instrumenter;
115121

@@ -142,6 +148,7 @@ export class Span implements SpanInterface {
142148
// eslint-disable-next-line deprecation/deprecation
143149
this.data = spanContext.data ? { ...spanContext.data } : {};
144150
this._attributes = spanContext.attributes ? { ...spanContext.attributes } : {};
151+
// eslint-disable-next-line deprecation/deprecation
145152
this.instrumenter = spanContext.instrumenter || 'sentry';
146153
this.origin = spanContext.origin || 'manual';
147154
// eslint-disable-next-line deprecation/deprecation

packages/types/src/span.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ export interface Span extends SpanContext {
221221

222222
/**
223223
* The instrumenter that created this span.
224+
*
225+
* @deprecated this field will be removed.
224226
*/
225227
instrumenter: Instrumenter;
226228

0 commit comments

Comments
 (0)