public void startSpanWithContext ( SpanBuilder spanBuilder , SpanContext context , String id ) { if ( context != null ) { spanBuilder . asChildOf ( 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 context it would cause a null pointer exception .