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



125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/aws-xray-sdk/facets/aws_sdk.rb', line 125

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