File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
- import type { SpanContext , SpanKind , SpanStatus } from '@opentelemetry/api' ;
1
+ import type { SpanKind , SpanStatus } from '@opentelemetry/api' ;
2
2
import type { ReadableSpan , TimedEvent } from '@opentelemetry/sdk-trace-node' ;
3
3
4
4
import type { AbstractSpan } from '../types' ;
@@ -54,7 +54,7 @@ export function spanHasName<SpanType extends AbstractSpan>(span: SpanType): span
54
54
*/
55
55
export function spanHasParentId < SpanType extends AbstractSpan > (
56
56
span : SpanType ,
57
- ) : span is SpanType & { spanContext ?: SpanContext } {
57
+ ) : span is SpanType {
58
58
const castSpan = span as ReadableSpan ;
59
59
return ! ! castSpan . parentSpanContext ?. spanId ;
60
60
}
Original file line number Diff line number Diff line change @@ -43,16 +43,16 @@ describe('spanTypes', () => {
43
43
describe ( 'spanHasParentId' , ( ) => {
44
44
it . each ( [
45
45
[ { } , false ] ,
46
- [ { parentSpanId : null } , false ] ,
47
- [ { parentSpanId : 'TEST_PARENT_ID' } , true ] ,
46
+ [ { parentSpanContext : { spanId : null } } , false ] ,
47
+ [ { parentSpanContext : { spanId : 'TEST_PARENT_ID' } } , true ] ,
48
48
] ) ( 'works with %p' , ( span , expected ) => {
49
49
const castSpan = span as unknown as Span ;
50
50
const actual = spanHasParentId ( castSpan ) ;
51
51
52
52
expect ( actual ) . toBe ( expected ) ;
53
53
54
54
if ( actual ) {
55
- expect ( castSpan . parentSpanId ) . toBeDefined ( ) ;
55
+ expect ( castSpan . parentSpanContext ?. spanId ) . toBeDefined ( ) ;
56
56
}
57
57
} ) ;
58
58
} ) ;
You can’t perform that action at this time.
0 commit comments