class Instana::Instrumentation::Shoryuken
Public Instance Methods
call(_worker_instance, _queue, sqs_message, _body) { || ... }
click to toggle source
# File lib/instana/instrumentation/shoryuken.rb, line 7 def call(_worker_instance, _queue, sqs_message, _body, &block) if sqs_message.is_a? Array return yield end sqs_tags = { sort: 'entry', queue: sqs_message.queue_url } context = incomming_context_from(sqs_message.message_attributes) ::Instana.tracer.start_or_continue_trace(:sqs, {sqs: sqs_tags}, context, &block) end
Private Instance Methods
incomming_context_from(attributes)
click to toggle source
# File lib/instana/instrumentation/shoryuken.rb, line 23 def incomming_context_from(attributes) trace_id = try(attributes, 'X_INSTANA_T', 'X_INSTANA_ST') span_id = try(attributes, 'X_INSTANA_S', 'X_INSTANA_SS') level = try(attributes, 'X_INSTANA_L', 'X_INSTANA_SL') { trace_id: trace_id, span_id: span_id, level: level }.reject { |_, v| v.nil? } end
try(attributes, *args)
click to toggle source
# File lib/instana/instrumentation/shoryuken.rb, line 35 def try(attributes, *args) key = args.detect do |a| attributes && attributes[a] && attributes[a].respond_to?(:string_value) end attributes[key].string_value if attributes && key end