class ElasticAPM::Spies::S3Spy
@api private
def self.accesspoint_region(params)
def self.accesspoint_region(params) if params[:bucket] && (match = AP_REGION_REGEX.match(params[:bucket])) match[1] end end
def self.bucket_name(params)
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
def self.formatted_op_name(operation_name)
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
def self.span_name(operation_name, bucket_name)
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
def self.without_net_http
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
def install
def install ::Aws::S3::Client.prepend(Ext) end