From d1ca17b5561e02daa7bcdf5e90f8223c057c464e Mon Sep 17 00:00:00 2001 From: "Adam Ling (MSFT)" Date: Wed, 14 Apr 2021 05:24:40 -0700 Subject: [PATCH 1/2] user agent impl update --- sdk/eventhub/azure-eventhub/CHANGELOG.md | 6 ++++++ .../azure-eventhub/azure/eventhub/_consumer_client.py | 4 ++-- .../azure-eventhub/azure/eventhub/_producer_client.py | 4 ++-- sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py | 2 +- sdk/eventhub/azure-eventhub/azure/eventhub/_version.py | 2 +- .../azure/eventhub/aio/_consumer_client_async.py | 4 ++-- .../azure/eventhub/aio/_producer_client_async.py | 4 ++-- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sdk/eventhub/azure-eventhub/CHANGELOG.md b/sdk/eventhub/azure-eventhub/CHANGELOG.md index b7b15068be25..17dd48cc3c51 100644 --- a/sdk/eventhub/azure-eventhub/CHANGELOG.md +++ b/sdk/eventhub/azure-eventhub/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 5.4.1 (Unreleased) + +**Bug Fixes** + +- Fixed bug that custom user agent string should be put in front of the built-in user agent string instead of being appended. + ## 5.4.0 (2021-04-07) This version follows from version 5.3.1, rather than 5.4.0b1 so that the preview idempotent producer feature is not included. diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer_client.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer_client.py index b8de8ad5ad03..2654715e5f58 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer_client.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer_client.py @@ -62,7 +62,7 @@ class EventHubConsumerClient(ClientBase): :keyword bool logging_enable: Whether to output network trace logs to the logger. Default is `False`. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. - :keyword str user_agent: The user agent that should be appended to the built-in user agent string. + :keyword str user_agent: If specified, this will be added in front of the user agent string. :keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default value is 3. The context of `retry_total` in receiving is special: The `receive` method is implemented by a while-loop calling internal receive method in each iteration. In the `receive` case, @@ -209,7 +209,7 @@ def from_connection_string(cls, conn_str, consumer_group, **kwargs): Additionally the following keys may also be present: `'username', 'password'`. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. - :keyword str user_agent: The user agent that should be appended to the built-in user agent string. + :keyword str user_agent: If specified, this will be added in front of the user agent string. :keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default value is 3. The context of `retry_total` in receiving is special: The `receive` method is implemented by a while-loop calling internal receive method in each iteration. In the `receive` case, diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_producer_client.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_producer_client.py index b9c40ba804a8..58872de05b43 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_producer_client.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_producer_client.py @@ -36,7 +36,7 @@ class EventHubProducerClient(ClientBase): :keyword bool logging_enable: Whether to output network trace logs to the logger. Default is `False`. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. - :keyword str user_agent: The user agent that should be appended to the built-in user agent string. + :keyword str user_agent: If specified, this will be added in front of the user agent string. :keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default value is 3. :keyword float idle_timeout: Timeout, in seconds, after which this client will close the underlying connection @@ -171,7 +171,7 @@ def from_connection_string(cls, conn_str, **kwargs): Additionally the following keys may also be present: `'username', 'password'`. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. - :keyword str user_agent: The user agent that should be appended to the built-in user agent string. + :keyword str user_agent: If specified, this will be added in front of the user agent string. :keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default value is 3. :keyword float idle_timeout: Timeout, in seconds, after which this client will close the underlying connection diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py index 77132260b78c..997ca2de8361 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py @@ -91,7 +91,7 @@ def create_properties(user_agent=None): USER_AGENT_PREFIX, VERSION, framework, platform_str ) if user_agent: - final_user_agent = "{} {}".format(final_user_agent, user_agent) + final_user_agent = "{} {}".format(user_agent, final_user_agent)) if len(final_user_agent) > MAX_USER_AGENT_LENGTH: raise ValueError( diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_version.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_version.py index 9f5574c56b5c..2f51b9a42da7 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_version.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "5.4.0" +VERSION = "5.4.1" diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_consumer_client_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_consumer_client_async.py index 3e95d8384420..55b979d05114 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_consumer_client_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_consumer_client_async.py @@ -69,7 +69,7 @@ class EventHubConsumerClient(ClientBaseAsync): :keyword bool logging_enable: Whether to output network trace logs to the logger. Default is `False`. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. - :keyword str user_agent: The user agent that should be appended to the built-in user agent string. + :keyword str user_agent: If specified, this will be added in front of the user agent string. :keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default value is 3. The context of `retry_total` in receiving is special: The `receive` method is implemented by a while-loop calling internal receive method in each iteration. In the `receive` case, @@ -229,7 +229,7 @@ def from_connection_string( Additionally the following keys may also be present: `'username', 'password'`. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. - :keyword str user_agent: The user agent that should be appended to the built-in user agent string. + :keyword str user_agent: If specified, this will be added in front of the user agent string. :keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default value is 3. The context of `retry_total` in receiving is special: The `receive` method is implemented by a while-loop calling internal receive method in each iteration. In the `receive` case, diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_producer_client_async.py b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_producer_client_async.py index fa1c92506099..199ede1e771c 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_producer_client_async.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/aio/_producer_client_async.py @@ -39,7 +39,7 @@ class EventHubProducerClient(ClientBaseAsync): :keyword bool logging_enable: Whether to output network trace logs to the logger. Default is `False`. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. - :keyword str user_agent: The user agent that should be appended to the built-in user agent string. + :keyword str user_agent: If specified, this will be added in front of the user agent string. :keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default value is 3. :keyword float idle_timeout: Timeout, in seconds, after which this client will close the underlying connection @@ -189,7 +189,7 @@ def from_connection_string( Additionally the following keys may also be present: `'username', 'password'`. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. - :keyword str user_agent: The user agent that should be appended to the built-in user agent string. + :keyword str user_agent: If specified, this will be added in front of the user agent string. :keyword int retry_total: The total number of attempts to redo a failed operation when an error occurs. Default value is 3. :keyword float idle_timeout: Timeout, in seconds, after which this client will close the underlying connection From 029a154c2595cca30a7d2141c3bbda326107abc3 Mon Sep 17 00:00:00 2001 From: "Adam Ling (MSFT)" Date: Wed, 14 Apr 2021 07:39:45 -0700 Subject: [PATCH 2/2] fix typo --- sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py index 997ca2de8361..9b7a5b18efc0 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_utils.py @@ -91,7 +91,7 @@ def create_properties(user_agent=None): USER_AGENT_PREFIX, VERSION, framework, platform_str ) if user_agent: - final_user_agent = "{} {}".format(user_agent, final_user_agent)) + final_user_agent = "{} {}".format(user_agent, final_user_agent) if len(final_user_agent) > MAX_USER_AGENT_LENGTH: raise ValueError(