class Trace::HttpApiClient
Constants
- SPANS_PATH
Public Instance Methods
perform(json_api_host, spans)
click to toggle source
# File lib/zipkin-tracer/zipkin_http_sender.rb, line 11 def perform(json_api_host, spans) spans_with_ips = ::ZipkinTracer::HostnameResolver.new.spans_with_ips(spans, ZipkinHttpSender::IP_FORMAT).map(&:to_h) resp = Faraday.new(json_api_host).post do |req| req.url SPANS_PATH req.headers['Content-Type'] = 'application/json' req.body = JSON.generate(spans_with_ips) end rescue Net::ReadTimeout, Faraday::ConnectionFailed => e error_message = "Error while connecting to #{json_api_host}: #{e.class.inspect} with message '#{e.message}'. " \ "Please make sure the URL / port are properly specified for the Zipkin server." SuckerPunch.logger.error(error_message) rescue => e SuckerPunch.logger.error(e) end