Sha256: 02acc09ef8270682863d7e45fa6b7add832d975e11dc478777d7c6daf4e89b6f

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

module Datadog
  module Tracing
    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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ddtrace-1.11.1 lib/datadog/tracing/contrib/aws/parsed_context.rb
ddtrace-1.11.0 lib/datadog/tracing/contrib/aws/parsed_context.rb
ddtrace-1.11.0.beta1 lib/datadog/tracing/contrib/aws/parsed_context.rb
ddtrace-1.10.1 lib/datadog/tracing/contrib/aws/parsed_context.rb
ddtrace-1.10.0 lib/datadog/tracing/contrib/aws/parsed_context.rb