protected void initFromExtractedTraceState ( APMSpanBuilder builder , TraceRecorder recorder , Reference ref , ContextSampler sampler ) { APMSpanBuilder parentBuilder = ( APMSpanBuilder ) ref . getReferredTo ( ) ; initTopLevelState ( this , recorder , sampler ) ; // Check for passed state if ( parentBuilder . state ( ) . containsKey ( Constants . HAWKULAR_APM_ID ) ) { setInteractionId ( parentBuilder . state ( ) . get ( Constants . HAWKULAR_APM_ID ) . toString ( ) ) ; traceContext . initTraceState ( parentBuilder . state ( ) ) ; } // Assume top level consumer, even if no state was provided, as span context // as passed using a 'child of' relationship getNodeBuilder ( ) . setNodeType ( NodeType . Consumer ) ; processRemainingReferences ( builder , ref ) ; }
This method initialises the span based on extracted trace state .