@@ -21,14 +21,13 @@ import {
21
21
SpanKind ,
22
22
SpanOptions ,
23
23
SpanStatus ,
24
- SpanContext ,
25
- TraceFlags ,
26
24
setSpan ,
27
25
ROOT_CONTEXT ,
28
26
getSpan ,
29
27
suppressInstrumentation ,
28
+ NoopSpan ,
30
29
} from '@opentelemetry/api' ;
31
- import { BasePlugin , NoRecordingSpan } from '@opentelemetry/core' ;
30
+ import { BasePlugin } from '@opentelemetry/core' ;
32
31
import type {
33
32
ClientRequest ,
34
33
IncomingMessage ,
@@ -60,12 +59,6 @@ export class HttpPlugin extends BasePlugin<Http> {
60
59
/** keep track on spans not ended */
61
60
private readonly _spanNotEnded : WeakSet < Span > ;
62
61
63
- private readonly _emptySpanContext : SpanContext = {
64
- traceId : '' ,
65
- spanId : '' ,
66
- traceFlags : TraceFlags . NONE ,
67
- } ;
68
-
69
62
constructor ( readonly moduleName : string , readonly version : string ) {
70
63
super ( `@opentelemetry/plugin-${ moduleName } ` , VERSION ) ;
71
64
// For now component is equal to moduleName but it can change in the future.
@@ -439,7 +432,7 @@ export class HttpPlugin extends BasePlugin<Http> {
439
432
440
433
private _startHttpSpan ( name : string , options : SpanOptions ) {
441
434
/*
442
- * If a parent is required but not present, we use a `NoRecordingSpan ` to still
435
+ * If a parent is required but not present, we use a `NoopSpan ` to still
443
436
* propagate context without recording it.
444
437
*/
445
438
const requireParent =
@@ -453,7 +446,7 @@ export class HttpPlugin extends BasePlugin<Http> {
453
446
if ( requireParent === true && currentSpan === undefined ) {
454
447
// TODO: Refactor this when a solution is found in
455
448
// https://github.com/open-telemetry/opentelemetry-specification/issues/530
456
- span = new NoRecordingSpan ( plugin . _emptySpanContext ) ;
449
+ span = new NoopSpan ( ) ;
457
450
} else if ( requireParent === true && currentSpan ?. context ( ) . isRemote ) {
458
451
span = currentSpan ;
459
452
} else {
0 commit comments