{Core} Refactor client factory for Track 2 SDK#15791
Merged
Conversation
Collaborator
|
Core |
jiasli
commented
Nov 4, 2020
Comment on lines
+123
to
+125
| # Disable ARMHttpLoggingPolicy which logs only allowed headers | ||
| from azure.core.pipeline.policies import SansIOHTTPPolicy | ||
| client_kwargs['http_logging_policy'] = SansIOHTTPPolicy() |
Member
Author
There was a problem hiding this comment.
@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.
Member
|
Can we add a timestamp for each log? |
qwordy
approved these changes
Nov 4, 2020
Member
Author
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. |
zhoxing-ms
approved these changes
Nov 4, 2020
Juliehzl
approved these changes
Nov 5, 2020
jsntcy
approved these changes
Nov 11, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).