Skip to content

Commit

Permalink
[EventHubs/ServiceBus] update network trace params to use empty strin…
Browse files Browse the repository at this point in the history
…gs not None (Azure#34458)

* update network trace params

* update network trace params eh

* update changelog
  • Loading branch information
swathipil authored Feb 27, 2024
1 parent 7c43327 commit 4521720
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 22 deletions.
4 changes: 4 additions & 0 deletions sdk/eventhub/azure-eventhub/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@

### Other Changes

- Updated network trace logging to replace `None` values in AMQP connection info with empty strings as per the OpenTelemetry specification.

## 5.11.6 (2024-02-12)

This version and all future versions will require Python 3.8+. Python 3.7 is no longer supported.

### Features Added

- Added `keep_alive` functionality on EventHubProducerClient to allow for long-living producers. [#33726](https://github.com/Azure/azure-sdk-for-python/issues/33726)

### Other Changes

- Added support for Python 3.12.

## 5.11.5 (2023-11-13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __init__( # pylint:disable=too-many-locals,too-many-statements
custom_endpoint = f"{custom_parsed_url.hostname}:{custom_port}{custom_parsed_url.path}"
self._container_id = container_id or str(uuid.uuid4())
self._network_trace = network_trace
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": None, "amqpLink": None}
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": "", "amqpLink": ""}

transport = kwargs.get("transport")
self._transport_type = transport_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(
self._network_trace_params = {
"amqpConnection": self._session._connection._container_id,
"amqpSession": self._session.name,
"amqpLink": None
"amqpLink": ""
}

self._token_status_code: Optional[int] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ async def close_async(self):
if self._keep_alive_thread:
await self._keep_alive_thread
self._keep_alive_thread = None
self._network_trace_params["amqpConnection"] = None
self._network_trace_params["amqpSession"] = None
self._network_trace_params["amqpConnection"] = ""
self._network_trace_params["amqpSession"] = ""

async def auth_complete_async(self):
"""Whether the authentication handshake is complete during
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __init__(# pylint:disable=too-many-locals,too-many-statements
custom_endpoint = f"{custom_parsed_url.hostname}:{custom_port}{custom_parsed_url.path}"
self._container_id: str = container_id or str(uuid.uuid4())
self._network_trace = network_trace
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": None, "amqpLink": None}
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": "", "amqpLink": ""}

transport = kwargs.get("transport")
self._transport_type = transport_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, session, endpoint='$management', **kwargs):
self._network_trace_params = {
"amqpConnection": self._session._connection._container_id,
"amqpSession": self._session.name,
"amqpLink": None
"amqpLink": ""
}
self._mgmt_link: ManagementLink = self._session.create_request_response_link_pair(
endpoint=endpoint,
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/cbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(
self._network_trace_params = {
"amqpConnection": self._session._connection._container_id,
"amqpSession": self._session.name,
"amqpLink": None
"amqpLink": ""
}

self._token_status_code: Optional[int] = None
Expand Down
6 changes: 3 additions & 3 deletions sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def __init__(self, hostname, **kwargs):
"remote_idle_timeout_empty_frame_send_ratio", None
)
self._network_trace = kwargs.pop("network_trace", False)
self._network_trace_params = {"amqpConnection": None, "amqpSession": None, "amqpLink": None}
self._network_trace_params = {"amqpConnection": "", "amqpSession": "", "amqpLink": ""}

# Session settings
self._outgoing_window = kwargs.pop("outgoing_window", OUTGOING_WINDOW)
Expand Down Expand Up @@ -377,8 +377,8 @@ def close(self):
except RuntimeError: # Probably thread failed to start in .open()
logging.debug("Keep alive thread failed to join.", exc_info=True)
self._keep_alive_thread = None
self._network_trace_params["amqpConnection"] = None
self._network_trace_params["amqpSession"] = None
self._network_trace_params["amqpConnection"] = ""
self._network_trace_params["amqpSession"] = ""

def auth_complete(self):
"""Whether the authentication handshake is complete during
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, session, endpoint='$management', **kwargs):
self._network_trace_params = {
"amqpConnection": self._session._connection._container_id,
"amqpSession": self._session.name,
"amqpLink": None
"amqpLink": ""
}
self._mgmt_link: ManagementLink = self._session.create_request_response_link_pair(
endpoint=endpoint,
Expand Down
1 change: 1 addition & 0 deletions sdk/servicebus/azure-servicebus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Other Changes

- Updated minimum `azure-core` version to 1.28.0.
- Updated network trace logging to replace `None` values in AMQP connection info with empty strings as per the OpenTelemetry specification ([#32190](https://github.com/Azure/azure-sdk-for-python/issues/32190)).

## 7.11.4 (2023-11-13)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __init__( # pylint:disable=too-many-locals,too-many-statements
custom_endpoint = f"{custom_parsed_url.hostname}:{custom_port}{custom_parsed_url.path}"
self._container_id = container_id or str(uuid.uuid4())
self._network_trace = network_trace
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": None, "amqpLink": None}
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": "", "amqpLink": ""}

transport = kwargs.get("transport")
self._transport_type = transport_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(
self._network_trace_params = {
"amqpConnection": self._session._connection._container_id,
"amqpSession": self._session.name,
"amqpLink": None
"amqpLink": ""
}

self._token_status_code: Optional[int] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ async def close_async(self):
if self._keep_alive_thread:
await self._keep_alive_thread
self._keep_alive_thread = None
self._network_trace_params["amqpConnection"] = None
self._network_trace_params["amqpSession"] = None
self._network_trace_params["amqpConnection"] = ""
self._network_trace_params["amqpSession"] = ""

async def auth_complete_async(self):
"""Whether the authentication handshake is complete during
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __init__(# pylint:disable=too-many-locals,too-many-statements
custom_endpoint = f"{custom_parsed_url.hostname}:{custom_port}{custom_parsed_url.path}"
self._container_id: str = container_id or str(uuid.uuid4())
self._network_trace = network_trace
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": None, "amqpLink": None}
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": "", "amqpLink": ""}

transport = kwargs.get("transport")
self._transport_type = transport_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, session, endpoint='$management', **kwargs):
self._network_trace_params = {
"amqpConnection": self._session._connection._container_id,
"amqpSession": self._session.name,
"amqpLink": None
"amqpLink": ""
}
self._mgmt_link: ManagementLink = self._session.create_request_response_link_pair(
endpoint=endpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(
self._network_trace_params = {
"amqpConnection": self._session._connection._container_id,
"amqpSession": self._session.name,
"amqpLink": None
"amqpLink": ""
}

self._token_status_code: Optional[int] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def __init__(self, hostname, **kwargs):
"remote_idle_timeout_empty_frame_send_ratio", None
)
self._network_trace = kwargs.pop("network_trace", False)
self._network_trace_params = {"amqpConnection": None, "amqpSession": None, "amqpLink": None}
self._network_trace_params = {"amqpConnection": "", "amqpSession": "", "amqpLink": ""}

# Session settings
self._outgoing_window = kwargs.pop("outgoing_window", OUTGOING_WINDOW)
Expand Down Expand Up @@ -377,8 +377,8 @@ def close(self):
except RuntimeError: # Probably thread failed to start in .open()
logging.debug("Keep alive thread failed to join.", exc_info=True)
self._keep_alive_thread = None
self._network_trace_params["amqpConnection"] = None
self._network_trace_params["amqpSession"] = None
self._network_trace_params["amqpConnection"] = ""
self._network_trace_params["amqpSession"] = ""

def auth_complete(self):
"""Whether the authentication handshake is complete during
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, session, endpoint='$management', **kwargs):
self._network_trace_params = {
"amqpConnection": self._session._connection._container_id,
"amqpSession": self._session.name,
"amqpLink": None
"amqpLink": ""
}
self._mgmt_link: ManagementLink = self._session.create_request_response_link_pair(
endpoint=endpoint,
Expand Down

0 comments on commit 4521720

Please sign in to comment.