Class: Atatus::Spies::DynamoDBSpy Private

Inherits:
Object
  • Object
show all
Defined in:
lib/atatus/spies/dynamo_db.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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.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.



25
26
27
28
29
30
31
# File 'lib/atatus/spies/dynamo_db.rb', line 25

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

  Atatus::Spies::NetHTTPSpy.disable_in do
    yield
  end
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.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/atatus/spies/dynamo_db.rb', line 33

def install
  if defined?(::Aws) && defined?(::Aws::DynamoDB) && defined?(::Aws::DynamoDB::Client)

    ::Aws::DynamoDB::Client.class_eval do
      # Alias all available operations
      api.operation_names.each do |operation_name|
        alias :"#{operation_name}_without_apm" :"#{operation_name}"

        define_method(operation_name) do |params = {}, options = {}|
          Atatus.with_span(operation_name, 'db', subtype: 'dynamodb', action: operation_name) do
            Atatus::Spies::DynamoDBSpy.without_net_http do
              original_method = method("#{operation_name}_without_apm")
              original_method.call(params, options)
            end
          end
        end
      end
    end

  end
end