code: func ExtractSpan(ctx context.Context) (opentracing.SpanContext, error) {
  	var spanCtx opentracing.SpanContext
  	span := opentracing.SpanFromContext(ctx)
  	if span == nil {
  		if s := pcontext.GetFromPropagateCtx(ctx, constants.SpanPropagateCtxKey); s != nil {
  			var err error
  			carrier, err := castValueToCarrier(s)
  			if err != nil {
  				return nil, err
  			}
  			tracer := opentracing.GlobalTracer()
  			spanCtx, err = tracer.Extract(opentracing.TextMap, carrier)
  			if err != nil {
  				return nil, err
  			}
  		} else {
  			return nil, nil
  		}
  	} else {
  		spanCtx = span.Context()
  	}
  	return spanCtx, nil
  }
docs: // ExtractSpan retrieves an opentracing span context from the given context.Context
  // The span context can be received directly (inside the context) or via an RPC call
  // (encoded in binary format)