lib/opentracing/instrumentation/redis/span_builder.rb in opentracing-instrumentation-0.1.8 vs lib/opentracing/instrumentation/redis/span_builder.rb in opentracing-instrumentation-0.1.9

- old
+ new

@@ -17,22 +17,23 @@ @error_writer = error_writer end def_delegators :@config, :tracer, - :span_name, + :operation_name_pattern, :component, :log_args, :log_reply def_delegators :@error_writer, :write_error - def start_active_scope(connection_class, peer_addr) + def start_active_scope(command, connection_class, peer_addr) + operation_name = build_operation_name(command) tags = build_tags(connection_class, peer_addr) tracer.start_active_span( - span_name, + operation_name, tags: tags, ) end def build_tags(connection_class, peer_addr) @@ -76,9 +77,16 @@ span.log_kv( event: EVENT_READ, 'redis.reply': JSON.dump(reply), ) + end + + private + + def build_operation_name(command) + command_name, * = command + format(operation_name_pattern, command: command_name) end end end end end