def report_spans(spans)
      return unless @state == :announced

      unless @discovered
        ::Instana.logger.debug("#{__method__} called but discovery hasn't run yet!")
        return false
      end

      path = "com.instana.plugin.ruby/traces.#{@process[:report_pid]}"
      uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}")
      req = Net::HTTP::Post.new(uri)

      opts = OJ_OPTIONS.merge({omit_nil: true})

      req.body = Oj.dump(spans, opts)
      response = make_host_agent_request(req)

      if response
        last_trace_response = response.code.to_i

        if [200, 204].include?(last_trace_response)
          return true
        end
      end
      false
    rescue => e
      Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
      Instana.logger.debug e.backtrace.join("\r\n")
    end
def report_spans(spans)
      return unless @state == :announced

      unless @discovered
        ::Instana.logger.debug("#{__method__} called but discovery hasn't run yet!")
        return false
      end

      path = "com.instana.plugin.ruby/traces.#{@process[:report_pid]}"
      uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}")
      req = Net::HTTP::Post.new(uri)

      opts = OJ_OPTIONS.merge({omit_nil: true})

      req.body = Oj.dump(spans, opts)
      response = make_host_agent_request(req)

      if response
        last_trace_response = response.code.to_i

        if [200, 204].include?(last_trace_response)
          return true
        end
      end
      false
    rescue => e
      Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
      Instana.logger.debug e.backtrace.join("\r\n")
    end
Accept and report spans to the host agent.

 @param traces [Array] An array of [Span]
 @return [Boolean]