module XRay::AwsSDKPatcher

Add X-Ray plugin to AWS SDK clients

Public Class Methods

patch(services: nil, recorder: XRay.recorder) click to toggle source
# 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