Class: Datadog::Contrib::Aws::ParsedContext

Inherits:
Object
  • Object
show all
Defined in:
lib/ddtrace/contrib/aws/parsed_context.rb

Overview

A wrapper around Seahorse::Client::RequestContext

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ ParsedContext

Returns a new instance of ParsedContext.



6
7
8
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 6

def initialize(context)
  @context = context
end

Instance Method Details

#hostObject



42
43
44
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 42

def host
  context.http_request.endpoint.host
end

#http_methodObject



26
27
28
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 26

def http_method
  context.http_request.http_method
end

#operationObject



18
19
20
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 18

def operation
  context.operation_name
end

#pathObject



38
39
40
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 38

def path
  context.http_request.endpoint.path
end

#regionObject



30
31
32
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 30

def region
  context.client.config.region
end

#resourceObject



14
15
16
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 14

def resource
  "#{service}.#{operation}"
end

#retry_attemptsObject



34
35
36
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 34

def retry_attempts
  context.retries
end

#safely(attr, fallback = nil) ⇒ Object



10
11
12
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 10

def safely(attr, fallback = nil)
  public_send(attr) rescue fallback
end

#status_codeObject



22
23
24
# File 'lib/ddtrace/contrib/aws/parsed_context.rb', line 22

def status_code
  context.http_response.status_code
end