Sha256: 47583b8245625755adb84a90a1c279a2364faed5c7a818e4d957d8c29cf09259

Contents?: true

Size: 1.03 KB

Versions: 94

Compression:

Stored size: 1.03 KB

Contents

module Datadog
  module Contrib
    module Aws
      # A wrapper around Seahorse::Client::RequestContext
      class ParsedContext
        def initialize(context)
          @context = context
        end

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

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

        def operation
          context.operation_name
        end

        def status_code
          context.http_response.status_code
        end

        def http_method
          context.http_request.http_method
        end

        def region
          context.client.config.region
        end

        def retry_attempts
          context.retries
        end

        def path
          context.http_request.endpoint.path
        end

        def host
          context.http_request.endpoint.host
        end

        private

        attr_reader :context

        def service
          context.client.class.to_s.split('::')[1].downcase
        end
      end
    end
  end
end

Version data entries

94 entries across 94 versions & 2 rubygems

Version Path
ddtrace-0.12.0.rc1 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.11.4 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.11.3 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.12.0.beta2 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.12.0.beta1 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.11.2 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.11.1 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.11.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.11.0.beta2 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.11.0.beta1 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.10.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.9.2 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.9.1 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.9.0 lib/ddtrace/contrib/aws/parsed_context.rb