Class: Trace::ZipkinRabbitMqSender

Inherits:
ZipkinSenderBase show all
Defined in:
lib/zipkin-tracer/zipkin_rabbit_mq_sender.rb

Overview

This class sends information to the Zipkin RabbitMQ Collector.

Constant Summary collapse

IP_FORMAT =
:string
DEFAULT_EXCHANGE =
''
DEAFULT_ROUTING_KEY =
'zipkin'

Instance Method Summary collapse

Methods inherited from ZipkinSenderBase

#end_span, #skip_flush?, #start_span, #with_new_span

Constructor Details

#initialize(options) ⇒ ZipkinRabbitMqSender

Returns a new instance of ZipkinRabbitMqSender.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/zipkin-tracer/zipkin_rabbit_mq_sender.rb', line 29

def initialize(options)
  connection = options[:rabbit_mq_connection]
  channel = connection.create_channel
  exchange_name = options[:rabbit_mq_exchange] || DEFAULT_EXCHANGE
  @routing_key = options[:rabbit_mq_routing_key] || DEAFULT_ROUTING_KEY
  @exchange = channel.exchange(exchange_name)
  @async = options[:async] != false
  SuckerPunch.logger = options[:logger]

  super(options)
end

Instance Method Details

#flush!Object



41
42
43
44
45
46
47
# File 'lib/zipkin-tracer/zipkin_rabbit_mq_sender.rb', line 41

def flush!
  if @async
    RabbitMqPublisher.perform_async(@exchange, @routing_key, spans.dup)
  else
    RabbitMqPublisher.new.perform(@exchange, @routing_key, spans)
  end
end