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



49
50
51
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 49

def host
  context.http_request.endpoint.host
end

#http_methodObject



33
34
35
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 33

def http_method
  context.http_request.http_method
end

#operationObject



21
22
23
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 21

def operation
  context.operation_name
end

#paramsObject



25
26
27
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 25

def params
  context.params
end

#pathObject



45
46
47
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 45

def path
  context.http_request.endpoint.path
end

#regionObject



37
38
39
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 37

def region
  context.client.config.region
end

#resourceObject



17
18
19
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 17

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

#retry_attemptsObject



41
42
43
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 41

def retry_attempts
  context.retries
end

#safely(attr, fallback = nil) ⇒ Object



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

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

#status_codeObject



29
30
31
# File 'lib/datadog/tracing/contrib/aws/parsed_context.rb', line 29

def status_code
  context.http_response.status_code
end