class OpenTelemetry::Instrumentation::AwsSdk::Instrumentation

Instrumentation class that detects and installs the AwsSdk instrumentation

Constants

MINIMUM_VERSION

Public Instance Methods

gem_version() click to toggle source
# File lib/opentelemetry/instrumentation/aws_sdk/instrumentation.rb, line 30
def gem_version
  if Gem.loaded_specs['aws-sdk']
    Gem.loaded_specs['aws-sdk'].version
  elsif Gem.loaded_specs['aws-sdk-core']
    Gem.loaded_specs['aws-sdk-core'].version
  end
end

Private Instance Methods

add_plugin(*targets) click to toggle source
# File lib/opentelemetry/instrumentation/aws_sdk/instrumentation.rb, line 47
def add_plugin(*targets)
  targets.each { |klass| klass.add_plugin(AwsSdk::Plugin) }
end
loaded_constants() click to toggle source
# File lib/opentelemetry/instrumentation/aws_sdk/instrumentation.rb, line 51
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)

    begin
      constants << ::Aws.const_get(service, false).const_get(:Client, false)
    rescue StandardError => e
      OpenTelemetry.logger.warn("Constant could not be loaded: #{e}")
    end
  end
end
require_dependencies() click to toggle source
# File lib/opentelemetry/instrumentation/aws_sdk/instrumentation.rb, line 40
def require_dependencies
  require_relative 'handler'
  require_relative 'services'
  require_relative 'message_attributes'
  require_relative 'messaging_helper'
end