public void startSpanWithParent ( SpanBuilder spanBuilder , Span parent , String id ) { if ( parent != null ) { spanBuilder . asChildOf ( parent . context ( ) ) ; } doStartSpan ( spanBuilder , id ) ; }
This is a convenience method for situations where we don t know if a parent span is available . If we try to add a childOf relationship to a null parent it would cause a null pointer exception .