Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions redis/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,17 @@ def __init__(self, *, path: str = "", **kwargs):
self.path = path
super().__init__(**kwargs)

# host and port properties are required for OTel instrumentation compatibility.
# TCP Connection has these as attributes; Unix sockets use path instead.

@property
def host(self):
return self.path

@property
def port(self):
return None

def repr_pieces(self) -> Iterable[Tuple[str, Union[str, int]]]:
pieces = [("path", self.path), ("db", self.db)]
if self.client_name:
Expand Down
11 changes: 11 additions & 0 deletions redis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2090,6 +2090,17 @@ def __init__(self, path="", socket_timeout=None, **kwargs):
self.path = path
self.socket_timeout = socket_timeout

# host and port properties are required for OTel instrumentation compatibility.
# TCP Connection has these as attributes; Unix sockets use path instead.

@property
def host(self):
return self.path

@property
def port(self):
return None

def repr_pieces(self):
pieces = [("path", self.path), ("db", self.db)]
if self.client_name:
Expand Down