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.51.1 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.51.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.50.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.49.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.48.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.47.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.46.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.45.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.44.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.43.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.42.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.41.0 lib/ddtrace/contrib/aws/parsed_context.rb
ls-trace-0.2.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.40.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.39.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.38.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.37.0 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.36.0 lib/ddtrace/contrib/aws/parsed_context.rb
ls-trace-0.1.2 lib/ddtrace/contrib/aws/parsed_context.rb
ddtrace-0.35.2 lib/ddtrace/contrib/aws/parsed_context.rb