Skip to content

Commit c57a18c

Browse files
authored
fix(ts): childOf not being able to be set to null (#7452)
* fix childOf not being able to be set to null * Add integrationName into ts declaration file
1 parent 1630815 commit c57a18c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

docs/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,8 @@ span = tracer.startSpan('test', {
434434
foo: 'bar'
435435
}
436436
});
437+
span = tracer.startSpan('test', { childOf: null })
438+
span = tracer.startSpan('test', { integrationName: 'testIntegration' })
437439

438440
tracer.trace('test', () => {})
439441
tracer.trace('test', { tags: { foo: 'bar' } }, () => {})

index.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,18 @@ interface Plugins {
295295
}
296296

297297
declare namespace tracer {
298-
export type SpanOptions = opentracing.SpanOptions;
298+
export type SpanOptions = Omit<opentracing.SpanOptions, 'childOf'> & {
299+
/**
300+
* Set childOf to 'null' to create a root span without a parent, even when a parent span
301+
* exists in the current async context. If 'undefined' the parent will be inferred from the
302+
* existing async context.
303+
*/
304+
childOf?: opentracing.Span | opentracing.SpanContext | null;
305+
/**
306+
* Optional name of the integration that crated this span.
307+
*/
308+
integrationName?: string;
309+
};
299310
export { Tracer };
300311

301312
export interface TraceOptions extends Analyzable {

0 commit comments

Comments
 (0)