Class: Instana::Instrumentation::Shoryuken

Inherits:
Object
  • Object
show all
Defined in:
lib/instana/instrumentation/shoryuken.rb

Instance Method Summary collapse

Instance Method Details

#call(_worker_instance, _queue, sqs_message, _body, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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_context = Instana::SpanContext.new(trace_id: context[:trace_id], span_id: context[:span_id], level: context[:level])
  Trace.with_span(OpenTelemetry::Trace.non_recording_span(instana_context)) do
    ::Instana.tracer.in_span(:sqs, attributes: {sqs: sqs_tags}, &block)
  end
end