protected void initChildOf ( APMSpanBuilder builder , Reference ref ) { APMSpan parent = ( APMSpan ) ref . getReferredTo ( ) ; if ( parent . getNodeBuilder ( ) != null ) { nodeBuilder = new NodeBuilder ( parent . getNodeBuilder ( ) ) ; traceContext = parent . traceContext ; // As it is not possible to know if a tag has been set after span // creation, we use this situation to check if the parent span // has the 'transaction.name' specified, to set on the trace // context. This is required in case a child span is used to invoke // another service (and needs to propagate the transaction // name). if ( parent . getTags ( ) . containsKey ( Constants . PROP_TRANSACTION_NAME ) && traceContext . getTransaction ( ) == null ) { traceContext . setTransaction ( parent . getTags ( ) . get ( Constants . PROP_TRANSACTION_NAME ) . toString ( ) ) ; } } processRemainingReferences ( builder , ref ) ; }
This method initialises the span based on a child - of relationship .