This repository was archived by the owner on Oct 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +12
-32
lines changed
packages/opencensus-core/src/trace/model Expand file tree Collapse file tree 5 files changed +12
-32
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44
55## Unreleased
66
7+ ** This release has a breaking change. Please test your code accordingly after upgrading.**
8+
9+ - Remove Span's ` startChildSpan(nameOrOptions?: string|SpanOptions, kind?: SpanKind) ` interface, now only ` SpanOptions ` object interface is supported.
710
811## 0.0.12 - 2019-05-13
912- Add ` defaultAttributes ` config to ` Tracer.start(config) `
Original file line number Diff line number Diff line change @@ -184,25 +184,12 @@ export class NoRecordSpan implements types.Span {
184184
185185 /**
186186 * Starts a new no record child span in the no record root span.
187- * @param nameOrOptions Span name string or SpanOptions object.
188- * @param kind Span kind if not using SpanOptions object.
187+ * @param [options] A SpanOptions object to start a child span.
189188 */
190- startChildSpan (
191- nameOrOptions ?: string | types . SpanOptions ,
192- kind ?: types . SpanKind ) : types . Span {
189+ startChildSpan ( options ?: types . SpanOptions ) : types . Span {
193190 const noRecordChild = new NoRecordSpan ( this ) ;
194-
195- const spanName =
196- typeof nameOrOptions === 'object' ? nameOrOptions . name : nameOrOptions ;
197- const spanKind =
198- typeof nameOrOptions === 'object' ? nameOrOptions . kind : kind ;
199- if ( spanName ) {
200- noRecordChild . name = spanName ;
201- }
202- if ( spanKind ) {
203- noRecordChild . kind = spanKind ;
204- }
205-
191+ if ( options && options . name ) noRecordChild . name = options . name ;
192+ if ( options && options . kind ) noRecordChild . kind = options . kind ;
206193 noRecordChild . start ( ) ;
207194 return noRecordChild ;
208195 }
Original file line number Diff line number Diff line change @@ -346,12 +346,9 @@ export class Span implements types.Span {
346346
347347 /**
348348 * Starts a new child span.
349- * @param nameOrOptions Span name string or SpanOptions object.
350- * @param kind Span kind if not using SpanOptions object.
349+ * @param [options] A SpanOptions object to start a child span.
351350 */
352- startChildSpan (
353- nameOrOptions ?: string | types . SpanOptions ,
354- kind ?: types . SpanKind ) : types . Span {
351+ startChildSpan ( options ?: types . SpanOptions ) : types . Span {
355352 if ( this . ended ) {
356353 this . logger . debug (
357354 'calling %s.startSpan() on ended %s %o' , this . className ,
@@ -366,12 +363,8 @@ export class Span implements types.Span {
366363 }
367364
368365 const child = new Span ( this . tracer , this ) ;
369- const spanName =
370- typeof nameOrOptions === 'object' ? nameOrOptions . name : nameOrOptions ;
371- const spanKind =
372- typeof nameOrOptions === 'object' ? nameOrOptions . kind : kind ;
373- if ( spanName ) child . name = spanName ;
374- if ( spanKind ) child . kind = spanKind ;
366+ if ( options && options . name ) child . name = options . name ;
367+ if ( options && options . kind ) child . kind = options . kind ;
375368
376369 child . start ( ) ;
377370 this . spansLocal . push ( child ) ;
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ export class CoreTracerBase implements types.TracerBase {
215215 'no current trace found - must start a new root span first' ) ;
216216 return new NoRecordSpan ( ) ;
217217 }
218- const span = options . childOf . startChildSpan ( options . name , options . kind ) ;
218+ const span = options . childOf . startChildSpan ( options ) ;
219219
220220 // Add default attributes
221221 const defaultAttributes = this . config && this . config . defaultAttributes ;
Original file line number Diff line number Diff line change @@ -458,9 +458,7 @@ export interface Span {
458458 truncate ( ) : void ;
459459
460460 /** Starts a new Span instance as a child of this instance */
461- startChildSpan ( name ?: string , kind ?: SpanKind ) : Span ;
462461 startChildSpan ( options ?: SpanOptions ) : Span ;
463- startChildSpan ( nameOrOptions ?: string | SpanOptions , kind ?: SpanKind ) : Span ;
464462}
465463
466464/** Interface for TracerBase */
@@ -515,7 +513,6 @@ export interface TracerBase extends SpanEventListener {
515513
516514 /**
517515 * Start a new Span instance to the currentRootSpan
518- * @param childOf Span
519516 * @param [options] A TraceOptions object to start a root span.
520517 * @returns The new Span instance started
521518 */
You can’t perform that action at this time.
0 commit comments