public HttpRequestContext handleStart ( C carrier , Q request ) { checkNotNull ( carrier , "carrier" ) ; checkNotNull ( request , "request" ) ; SpanBuilder spanBuilder = null ; String spanName = getSpanName ( request , extractor ) ; // de-serialize the context SpanContext spanContext = null ; try { spanContext = textFormat . extract ( carrier , getter ) ; } catch ( SpanContextParseException e ) { // TODO: Currently we cannot distinguish between context parse error and missing context. // Logging would be annoying so we just ignore this error and do not even log a message. } if ( spanContext == null || publicEndpoint ) { spanBuilder = tracer . spanBuilder ( spanName ) ; } else { spanBuilder = tracer . spanBuilderWithRemoteParent ( spanName , spanContext ) ; } Span span = spanBuilder . setSpanKind ( Kind . SERVER ) . startSpan ( ) ; if ( publicEndpoint && spanContext != null ) { span . addLink ( Link . fromSpanContext ( spanContext , Type . PARENT_LINKED_SPAN ) ) ; } if ( span . getOptions ( ) . contains ( Options . RECORD_EVENTS ) ) { addSpanRequestAttributes ( span , request , extractor ) ; } return getNewContext ( span , tagger . getCurrentTagContext ( ) ) ; }
Instrument an incoming request before it is handled .