-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Core} Refactor client factory for Track 2 SDK #15791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Core |
| # Disable ARMHttpLoggingPolicy which logs only allowed headers | ||
| from azure.core.pipeline.policies import SansIOHTTPPolicy | ||
| client_kwargs['http_logging_policy'] = SansIOHTTPPolicy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qwordy, This will remove the duplicated network trace.
azure.core.pipeline.policies._universal : Request URL: 'https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590?api-version=2016-06-01'
azure.core.pipeline.policies._universal : Request method: 'GET'
azure.core.pipeline.policies._universal : Request headers:
azure.core.pipeline.policies._universal : 'Accept': 'application/json'
...
azure.core.pipeline.policies.http_logging_policy : Request URL: 'https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590?api-version=REDACTED'
azure.core.pipeline.policies.http_logging_policy : Request method: 'GET'
azure.core.pipeline.policies.http_logging_policy : Request headers:
azure.core.pipeline.policies.http_logging_policy : 'Accept': 'application/json'
...
azure.core.pipeline.policies.http_logging_policy : Response status: 200
azure.core.pipeline.policies.http_logging_policy : Response headers:
azure.core.pipeline.policies.http_logging_policy : 'Cache-Control': 'no-cache'
...
azure.core.pipeline.policies._universal : Response status: 200
azure.core.pipeline.policies._universal : Response headers:
azure.core.pipeline.policies._universal : 'Cache-Control': 'no-cache'
...
Logs from azure.core.pipeline.policies.http_logging_policy will now be disabled.
|
Can we add a timestamp for each log? |
This is very tricky because python's logging doesn't support UTC formatting with microseconds. We need to write our own customized logger for this. This will be addressed in the future in a separate PR. |
Description
Rename
configure_common_settings_track2to_prepare_client_kwargs_track2Add a leading underscore (
_), because it is a private function which is only used by_get_mgmt_service_clientIn Track 1 SDK,
configis a public member of the client and can be configured later:https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-resource_10.2.0/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py#L45
In Track 2 SDK,
_configis a private member, so configuration should be done viakwargsduring__init__of the client:https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-resource_15.0.0/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py#L51
Replace the name to better reflect the functionality of the function.
Disable
INFOlog from Track 2 SDK for now until it is included in the--verboselog of Azure CLI ([Core] Print INFO log from SDK #15676).