Skip to content

Commit

Permalink
Fix net peer attribute for unix socket connection
Browse files Browse the repository at this point in the history
  • Loading branch information
shadchin committed May 3, 2024
1 parent 1ee7261 commit be2c578
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ def _extract_conn_attributes(conn_kwargs):
}
db = conn_kwargs.get("db", 0)
attributes[SpanAttributes.DB_REDIS_DATABASE_INDEX] = db
try:
if "path" in conn_kwargs:
attributes[SpanAttributes.NET_PEER_NAME] = conn_kwargs.get("path", "")
attributes[SpanAttributes.NET_TRANSPORT] = (
NetTransportValues.OTHER.value
)
else:
attributes[SpanAttributes.NET_PEER_NAME] = conn_kwargs.get(
"host", "localhost"
)
Expand All @@ -39,11 +44,6 @@ def _extract_conn_attributes(conn_kwargs):
attributes[SpanAttributes.NET_TRANSPORT] = (
NetTransportValues.IP_TCP.value
)
except KeyError:
attributes[SpanAttributes.NET_PEER_NAME] = conn_kwargs.get("path", "")
attributes[SpanAttributes.NET_TRANSPORT] = (
NetTransportValues.OTHER.value
)

return attributes

Expand Down

0 comments on commit be2c578

Please sign in to comment.