Module: NewRelic::Agent::Instrumentation::AwsSqs
- Included in:
- AwsSqs::Prepend
- Defined in:
- lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb
Defined Under Namespace
Constant Summary collapse
- MESSAGING_LIBRARY =
'SQS'
Instance Method Summary collapse
- #receive_message_with_new_relic(*args) ⇒ Object
- #send_message_batch_with_new_relic(*args) ⇒ Object
- #send_message_with_new_relic(*args) ⇒ Object
- #with_tracing(action, params) ⇒ Object
Instance Method Details
#receive_message_with_new_relic(*args) ⇒ Object
21 22 23 24 25 |
# File 'lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb', line 21 def (*args) with_tracing(:consume, args) do yield end end |
#send_message_batch_with_new_relic(*args) ⇒ Object
15 16 17 18 19 |
# File 'lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb', line 15 def (*args) with_tracing(:produce, args) do yield end end |
#send_message_with_new_relic(*args) ⇒ Object
9 10 11 12 13 |
# File 'lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb', line 9 def (*args) with_tracing(:produce, args) do yield end end |
#with_tracing(action, params) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb', line 27 def with_tracing(action, params) segment = nil begin info = get_url_info(params[0]) segment = NewRelic::Agent::Tracer.( action: action, library: MESSAGING_LIBRARY, destination_type: :queue, destination_name: info[:queue_name] ) add_aws_attributes(segment, info) rescue => e NewRelic::Agent.logger.error('Error starting message broker segment in Aws::SQS::Client', e) end NewRelic::Agent::Tracer.capture_segment_error(segment) do yield end ensure segment&.finish end |