lib/barbeque_client/client.rb in barbeque_client-0.8.2 vs lib/barbeque_client/client.rb in barbeque_client-0.9.0
- old
+ new
@@ -1,14 +1,15 @@
require 'garage_client'
require 'json'
module BarbequeClient
class Client
- def initialize(application:, default_queue:, endpoint:)
+ def initialize(application:, default_queue:, endpoint:, tracing: {})
@application = application
@default_queue = default_queue
@endpoint = endpoint
+ @tracing = tracing
end
# @param [String] job - Job name to enqueue.
# @param [Object] message - An object which is serializable as JSON.
# @param optional [String] queue - A queue name to enqueue a job.
@@ -48,12 +49,15 @@
end
private
def garage_client
- @garage_client ||= GarageClient::Client.new(
- endpoint: @endpoint,
- path_prefix: '/',
- )
+ @garage_client ||= GarageClient::Client.new(garage_client_option)
+ end
+
+ def garage_client_option
+ option = { endpoint: @endpoint, path_prefix: '/' }
+ option[:tracing] = @tracing if @tracing[:tracer]
+ option
end
end
end