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

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/tracing/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.



9
10
11
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 9

def initialize(context)
  @context = context
end

Instance Method Details

#hostObject



55
56
57
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 55

def host
  context.http_request.endpoint.host
end

#http_methodObject



39
40
41
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 39

def http_method
  context.http_request.http_method
end

#http_responseObject



31
32
33
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 31

def http_response
  context.http_response
end

#operationObject



23
24
25
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 23

def operation
  context.operation_name
end

#paramsObject



27
28
29
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 27

def params
  context.params
end

#pathObject



51
52
53
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 51

def path
  context.http_request.endpoint.path
end

#regionObject



43
44
45
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 43

def region
  context.client.config.region
end

#resourceObject



19
20
21
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 19

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

#retry_attemptsObject



47
48
49
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 47

def retry_attempts
  context.retries
end

#safely(attr, fallback = nil) ⇒ Object



13
14
15
16
17
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 13

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

#status_codeObject



35
36
37
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 35

def status_code
  http_response.status_code
end