class ElasticAPM::Spies::S3Spy

@api private

Constants

AP_REGEX
AP_REGION_REGEX
MUTEX
SUBTYPE
TYPE

Public Class Methods

accesspoint_region(params) click to toggle source
# File lib/elastic_apm/spies/s3.rb, line 50
def self.accesspoint_region(params)
  if params[:bucket] && (match = AP_REGION_REGEX.match(params[:bucket]))
    match[1]
  end
end
bucket_name(params) click to toggle source
# File lib/elastic_apm/spies/s3.rb, line 43
def self.bucket_name(params)
  return unless (bucket = params[:bucket]&.to_s)
  return bucket unless (index = bucket.rindex(AP_REGEX))

  bucket[index+1..-1]
end
formatted_op_name(operation_name) click to toggle source
# File lib/elastic_apm/spies/s3.rb, line 61
def self.formatted_op_name(operation_name)
  if @@formatted_op_names[operation_name]
    return @@formatted_op_names[operation_name]
  end

  MUTEX.synchronize do
    if @@formatted_op_names[operation_name]
      return @@formatted_op_names[operation_name]
    end

    @@formatted_op_names[operation_name] =
      operation_name.to_s.split('_').collect(&:capitalize).join
  end

  @@formatted_op_names[operation_name]
end
span_name(operation_name, bucket_name) click to toggle source
# File lib/elastic_apm/spies/s3.rb, line 56
def self.span_name(operation_name, bucket_name)
  bucket_name ? "S3 #{formatted_op_name(operation_name)} #{bucket_name}" :
    "S3 #{formatted_op_name(operation_name)}"
end
without_net_http() { || ... } click to toggle source
# File lib/elastic_apm/spies/s3.rb, line 33
def self.without_net_http
  return yield unless defined?(NetHTTPSpy)

  # rubocop:disable Style/ExplicitBlockArgument
  ElasticAPM::Spies::NetHTTPSpy.disable_in do
    yield
  end
  # rubocop:enable Style/ExplicitBlockArgument
end

Public Instance Methods

install() click to toggle source
# File lib/elastic_apm/spies/s3.rb, line 121
def install
  ::Aws::S3::Client.prepend(Ext)
end