class Instana::Instrumentation::S3::Handler

Public Instance Methods

call(context) click to toggle source
# File lib/instana/instrumentation/aws_sdk_s3.rb, line 8
def call(context)
  s3_tags = {
    op: format_operation(context.operation_name),
    bucket: bucket_name_from(context),
    key: key_from_context(context)
  }.reject { |_, v| v.nil? }

  ::Instana.tracer.trace(:s3, {s3: s3_tags}) { @handler.call(context) }
end

Private Instance Methods

bucket_name_from(context) click to toggle source
# File lib/instana/instrumentation/aws_sdk_s3.rb, line 20
def bucket_name_from(context)
  context.params[:bucket] || 'Unknown'
end
format_operation(name) click to toggle source
# File lib/instana/instrumentation/aws_sdk_s3.rb, line 28
def format_operation(name)
  case name
  when :create_bucket
    'createBucket'
  when :delete_bucket
    'deleteBucket'
  when :delete_object
    'delete'
  when :get_object
    'get'
  when :head_object
    'metadata'
  when :list_objects
    'list'
  when :put_object
    'list'
  else
    name.to_s
  end
end
key_from_context(context) click to toggle source
# File lib/instana/instrumentation/aws_sdk_s3.rb, line 24
def key_from_context(context)
  context.params[:key]
end