Method: Datadog::Tracing::Contrib::Aws::Patcher.loaded_constants
- Defined in:
- lib/datadog/tracing/contrib/aws/patcher.rb
.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 |