class Instana::Instrumentation::SQS::Handler
Constants
- SPAN_FORMING_OPERATIONS
Public Instance Methods
call(context)
click to toggle source
# File lib/instana/instrumentation/aws_sdk_sqs.rb, line 10 def call(context) is_tracing = ::Instana.tracer.tracing? unless is_tracing && SPAN_FORMING_OPERATIONS.include?(context.operation_name) return @handler.call(context) end span_tags = tags_for(context.operation_name, context.params).reject { |_, v| v.nil? } ::Instana.tracer.trace(:sqs, {sqs: span_tags}) do |span| case context.operation_name when :send_message inject_instana_headers(span, context.params) when :send_message_batch context.params[:entries].each { |e| inject_instana_headers(span, e) } end response = @handler.call(context) span_tags[:queue] = response.queue_url if response.respond_to?(:queue_url) span.set_tags(sqs: span_tags) response end end
Private Instance Methods
inject_instana_headers(span, params)
click to toggle source
# File lib/instana/instrumentation/aws_sdk_sqs.rb, line 37 def inject_instana_headers(span, params) params[:message_attributes] ||= {} params[:message_attributes].merge!({ "X_INSTANA_T" => {data_type: 'String', string_value: span.context.trace_id}, "X_INSTANA_S" => {data_type: 'String', string_value: span.context.span_id}, "X_INSTANA_L" => {data_type: 'String', string_value: span.context.level.to_s} }) end