module RailsOpentracer
Constants
- VERSION
Public Instance Methods
get(url)
click to toggle source
# File lib/rails_opentracer.rb, line 11 def get(url) connection = Faraday.new do |con| con.use Faraday::Adapter::NetHttp end if ZipkinConfig.opentracer_enabled_and_zipkin_url_present? carrier = {} OpenTracing.inject(@span.context, OpenTracing::FORMAT_RACK, carrier) connection.headers = denilize(carrier) elsif ZipkinConfig.opentracer_enabled? Rails.logger.error 'TRACER_ERROR: `ZIPKIN_SERVICE_URL` environment variable is not defined' end connection.get(url) end
with_span(name) { || ... }
click to toggle source
# File lib/rails_opentracer.rb, line 26 def with_span(name) if ZipkinConfig.opentracer_enabled_and_zipkin_url_present? @span = if $active_span.present? OpenTracing.start_span(name, child_of: $active_span) else OpenTracing.start_span(name) end yield if block_given? @span.finish elsif block_given? yield end end
Private Instance Methods
denilize(hash)
click to toggle source
# File lib/rails_opentracer.rb, line 43 def denilize(hash) hash.each_key { |k, _v| hash[k] = '' if hash[k].nil? } end