File tree 1 file changed +6
-6
lines changed
instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,12 @@ def _extract_conn_attributes(conn_kwargs):
29
29
}
30
30
db = conn_kwargs .get ("db" , 0 )
31
31
attributes [SpanAttributes .DB_REDIS_DATABASE_INDEX ] = db
32
- try :
32
+ if "path" in conn_kwargs :
33
+ attributes [SpanAttributes .NET_PEER_NAME ] = conn_kwargs .get ("path" , "" )
34
+ attributes [SpanAttributes .NET_TRANSPORT ] = (
35
+ NetTransportValues .OTHER .value
36
+ )
37
+ else :
33
38
attributes [SpanAttributes .NET_PEER_NAME ] = conn_kwargs .get (
34
39
"host" , "localhost"
35
40
)
@@ -39,11 +44,6 @@ def _extract_conn_attributes(conn_kwargs):
39
44
attributes [SpanAttributes .NET_TRANSPORT ] = (
40
45
NetTransportValues .IP_TCP .value
41
46
)
42
- except KeyError :
43
- attributes [SpanAttributes .NET_PEER_NAME ] = conn_kwargs .get ("path" , "" )
44
- attributes [SpanAttributes .NET_TRANSPORT ] = (
45
- NetTransportValues .OTHER .value
46
- )
47
47
48
48
return attributes
49
49
You can’t perform that action at this time.
0 commit comments