Module: Datadog::Tracing::Contrib::Aws::Patcher
- Includes:
- Patcher
- Defined in:
- lib/datadog/tracing/contrib/aws/patcher.rb
Overview
Patcher enables patching of ‘aws’ module.
Class Method Summary collapse
- .add_plugin(*targets) ⇒ Object
- .get_option(option) ⇒ Object
- .loaded_constants ⇒ Object
- .patch ⇒ Object
- .target_version ⇒ Object
Methods included from Patcher
Class Method Details
.add_plugin(*targets) ⇒ Object
32 33 34 |
# File 'lib/datadog/tracing/contrib/aws/patcher.rb', line 32 def add_plugin(*targets) targets.each { |klass| klass.add_plugin(Instrumentation) } end |
.get_option(option) ⇒ Object
50 51 52 |
# File 'lib/datadog/tracing/contrib/aws/patcher.rb', line 50 def get_option(option) Datadog.configuration.tracing[:aws].get_option(option) end |
.loaded_constants ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/datadog/tracing/contrib/aws/patcher.rb', line 36 def loaded_constants # Cross-check services against loaded AWS constants # Module#const_get can return a constant from ancestors when there's a miss. # If this conincidentally matches another constant, it will attempt to patch # the wrong constant, resulting in patch failure. available_services = ::Aws.constants & SERVICES.map(&:to_sym) available_services.each_with_object([]) do |service, constants| next if ::Aws.autoload?(service) constants << ::Aws.const_get(service, false).const_get(:Client, false) rescue next end end |
.patch ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/datadog/tracing/contrib/aws/patcher.rb', line 20 def patch require_relative 'parsed_context' require_relative 'instrumentation' require_relative 'services' add_plugin(Seahorse::Client::Base, *loaded_constants) # Special handling for S3 URL Presigning. # @see Datadog::Tracing::Contrib::Aws::S3Presigner ::Aws::S3::Presigner.prepend(S3Presigner) if defined?(::Aws::S3::Presigner) end |
.target_version ⇒ Object
16 17 18 |
# File 'lib/datadog/tracing/contrib/aws/patcher.rb', line 16 def target_version Integration.version end |