Sha256: a6dec6b32752867124ae986f153af3c0b55d03fe4b1845f782a637b15ef0405f

Contents?: true

Size: 1.13 KB

Versions: 60

Compression:

Stored size: 1.13 KB

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

module Instana
  module Instrumentation
    class DynamoDB < Seahorse::Client::Plugin
      class Handler < Seahorse::Client::Handler
        def call(context)
          dynamo_tags = {
            op: format_operation(context.operation_name),
            table: table_name_from(context)
          }

          ::Instana.tracer.trace(:dynamodb, {dynamodb: dynamo_tags}) { @handler.call(context) }
        end

        private

        def table_name_from(context)
          context.params[:table_name] || context.params[:global_table_name] || 'Unknown'
        end

        def format_operation(name)
          case name
          when :create_table
            'create'
          when :list_tables
            'list'
          when :get_item
            'get'
          when :put_item
            'put'
          when :update_item
            'update'
          when :delete_item
            'delete'
          else
            name.to_s
          end
        end
      end

      def add_handlers(handlers, _config)
        handlers.add(Handler, step: :initialize)
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
instana-1.202.0 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.201.0 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.201.0.pre1 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.200.0 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.200.0.pre1 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.199.6 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.199.5 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.199.4 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.199.3 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.199.2 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.199.1 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.199.0 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.198.0 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.198.0.pre1 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.197.0 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.197.0.pre2 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.197.0.pre1 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.195.4 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.195.3 lib/instana/instrumentation/aws_sdk_dynamodb.rb
instana-1.195.2 lib/instana/instrumentation/aws_sdk_dynamodb.rb