lib/opentelemetry/instrumentation/redis/patches/client.rb in opentelemetry-instrumentation-redis-0.10.1 vs lib/opentelemetry/instrumentation/redis/patches/client.rb in opentelemetry-instrumentation-redis-0.11.0

- old
+ new

@@ -1,8 +1,8 @@ # frozen_string_literal: true -# Copyright 2020 OpenTelemetry Authors +# Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation @@ -46,20 +46,26 @@ def client_attributes host = options[:host] port = options[:port] - OpenTelemetry::Instrumentation::Redis.attributes.merge( + attributes = { 'db.system' => 'redis', 'db.instance' => options[:db].to_s, 'db.url' => "redis://#{host}:#{port}", 'net.peer.name' => host, 'net.peer.port' => port - ) + } + attributes['peer.service'] = config[:peer_service] if config[:peer_service] + attributes.merge(OpenTelemetry::Instrumentation::Redis.attributes) end def tracer Redis::Instrumentation.instance.tracer + end + + def config + Redis::Instrumentation.instance.config end end end end end