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.



7
8
9
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 7

def initialize(context)
  @context = context
end

Instance Method Details

#hostObject



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

def host
  context.http_request.endpoint.host
end

#http_methodObject



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

def http_method
  context.http_request.http_method
end

#operationObject



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

def operation
  context.operation_name
end

#paramsObject



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

def params
  context.params
end

#pathObject



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

def path
  context.http_request.endpoint.path
end

#regionObject



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

def region
  context.client.config.region
end

#resourceObject



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

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

#retry_attemptsObject



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

def retry_attempts
  context.retries
end

#safely(attr, fallback = nil) ⇒ Object



11
12
13
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 11

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

#status_codeObject



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

def status_code
  context.http_response.status_code
end