Class: ElasticAPM::Spies::SQSSpy Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/spies/sqs.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: Ext

Constant Summary collapse

TYPE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'messaging'
SUBTYPE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'sqs'
REGION_REGEXP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%r{https://sqs\.([a-z0-9-]+)\.amazonaws}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.queue_name(params) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
43
44
# File 'lib/elastic_apm/spies/sqs.rb', line 40

def self.queue_name(params)
  if params[:queue_url]
    params[:queue_url].split('/')[-1]
  end
end

.region_from_url(url) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
49
50
# File 'lib/elastic_apm/spies/sqs.rb', line 46

def self.region_from_url(url)
  if match = REGION_REGEXP.match(url)
    match[1]
  end
end

.span_context(queue_name, region) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
55
56
57
58
59
60
61
# File 'lib/elastic_apm/spies/sqs.rb', line 52

def self.span_context(queue_name, region)
  ElasticAPM::Span::Context.new(
    message: { queue_name: queue_name },
    destination: {
      service: { resource: "#{SUBTYPE}/#{queue_name}" },
      cloud: { region: region }
    }
    # span links added here?
  )
end

.without_net_httpObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
33
34
35
36
37
38
# File 'lib/elastic_apm/spies/sqs.rb', line 30

def self.without_net_http
  return yield unless defined?(NetHTTPSpy)

  # rubocop:disable Style/ExplicitBlockArgument
  ElasticAPM::Spies::NetHTTPSpy.disable_in do
    yield
  end
  # rubocop:enable Style/ExplicitBlockArgument
end

Instance Method Details

#installObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



220
221
222
# File 'lib/elastic_apm/spies/sqs.rb', line 220

def install
  ::Aws::SQS::Client.prepend(Ext)
end