code: def calculate_segment_name(host_name, recorder):
      
      if recorder.dynamic_naming:
          return recorder.dynamic_naming.get_name(host_name)
      else:
          return recorder.service
docs: Returns the segment name based on recorder configuration and
      input host name. This is a helper generally used in web framework
      middleware where a host name is available from incoming request's headers.