Module: XRay::AwsSDKPatcher

Defined in:
lib/aws-xray-sdk/facets/aws_sdk.rb

Overview

Add X-Ray plugin to AWS SDK clients

Class Method Summary collapse

Class Method Details

.patch(services: nil, recorder: XRay.recorder) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/aws-xray-sdk/facets/aws_sdk.rb', line 113

def self.patch(services: nil, recorder: XRay.recorder)
  force = services.nil?
  services ||= AwsServices.whitelist
  services.each do |s|
    begin
      Aws.const_get(%(#{s}::Client)).add_plugin XRay::AwsSDKPlugin
      Aws.config.update xray_recorder: recorder
    rescue NameError
      # swallow the error if no explicit user config
      raise unless force
    end
  end
end