class Datadog::Contrib::Aws::ParsedContext

A wrapper around Seahorse::Client::RequestContext

Attributes

context[R]

Public Class Methods

new(context) click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 7
def initialize(context)
  @context = context
end

Public Instance Methods

host() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 43
def host
  context.http_request.endpoint.host
end
http_method() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 27
def http_method
  context.http_request.http_method
end
operation() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 19
def operation
  context.operation_name
end
path() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 39
def path
  context.http_request.endpoint.path
end
region() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 31
def region
  context.client.config.region
end
resource() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 15
def resource
  "#{service}.#{operation}"
end
retry_attempts() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 35
def retry_attempts
  context.retries
end
safely(attr, fallback = nil) click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 11
def safely(attr, fallback = nil)
  public_send(attr) rescue fallback
end
status_code() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 23
def status_code
  context.http_response.status_code
end

Private Instance Methods

service() click to toggle source
# File lib/ddtrace/contrib/aws/parsed_context.rb, line 51
def service
  context.client.class.to_s.split('::')[1].downcase
end