lib/instana/instrumentation/aws_sdk_dynamodb.rb in instana-1.195.1 vs lib/instana/instrumentation/aws_sdk_dynamodb.rb in instana-1.195.2

- old
+ new

@@ -5,20 +5,39 @@ module Instrumentation class DynamoDB < Seahorse::Client::Plugin class Handler < Seahorse::Client::Handler def call(context) dynamo_tags = { - op: context.operation_name, + op: format_operation(context.operation_name), table: table_name_from(context) } - ::Instana.tracer.trace(:dynamodb, dynamo_tags) { @handler.call(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)