Skip to content

Commit b1dfc55

Browse files
feat: [Many APIs] Add support for opt-in debug logging (#13341)
BEGIN_COMMIT_OVERRIDE feat: Add support for opt-in debug logging fix: Fix typing issue with gRPC metadata when key ends in -bin chore: Update gapic-generator-python to v1.21.0 END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. fix: Fix typing issue with gRPC metadata when key ends in -bin chore: Update gapic-generator-python to v1.21.0 PiperOrigin-RevId: 705285820 Source-Link: googleapis/googleapis@f9b8b91 Source-Link: googleapis/googleapis-gen@ca1e0a1 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFkcy1hZG1hbmFnZXIvLk93bEJvdC55YW1sIiwiaCI6ImNhMWUwYTFlNDcyZDZlNmY1ZGU4ODNhNWNiNTQ3MjRmMTEyY2UzNDgifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFkcy1tYXJrZXRpbmdwbGF0Zm9ybS1hZG1pbi8uT3dsQm90LnlhbWwiLCJoIjoiY2ExZTBhMWU0NzJkNmU2ZjVkZTg4M2E1Y2I1NDcyNGYxMTJjZTM0OCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiY2ExZTBhMWU0NzJkNmU2ZjVkZTg4M2E1Y2I1NDcyNGYxMTJjZTM0OCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1hZG1pbi8uT3dsQm90LnlhbWwiLCJoIjoiY2ExZTBhMWU0NzJkNmU2ZjVkZTg4M2E1Y2I1NDcyNGYxMTJjZTM0OCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1kYXRhLy5Pd2xCb3QueWFtbCIsImgiOiJjYTFlMGExZTQ3MmQ2ZTZmNWRlODgzYTVjYjU0NzI0ZjExMmNlMzQ4In0= Copy-Tag: eyJwIjoicGFja2FnZ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2xvYWRzLy5Pd2xCb3QueWFtbCIsImgiOiJjYTFlMGExZTQ3MmQ2ZTZmNWRlODgzYTVjYjU0NzI0ZjExMmNlMzQ4In0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent 8e6b0cc commit b1dfc55

File tree

530 files changed

+86465
-14257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

530 files changed

+86465
-14257
lines changed

packages/google-ads-admanager/google/ads/admanager/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.2.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-ads-admanager/google/ads/admanager_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.2.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-ads-admanager/google/ads/admanager_v1/services/ad_unit_service/client.py

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# limitations under the License.
1515
#
1616
from collections import OrderedDict
17+
import logging as std_logging
1718
import os
1819
import re
1920
from typing import (
@@ -48,6 +49,15 @@
4849
except AttributeError: # pragma: NO COVER
4950
OptionalRetry = Union[retries.Retry, object, None] # type: ignore
5051

52+
try:
53+
from google.api_core import client_logging # type: ignore
54+
55+
CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
56+
except ImportError: # pragma: NO COVER
57+
CLIENT_LOGGING_SUPPORTED = False
58+
59+
_LOGGER = std_logging.getLogger(__name__)
60+
5161
from google.longrunning import operations_pb2 # type: ignore
5262
from google.protobuf import duration_pb2 # type: ignore
5363
from google.protobuf import timestamp_pb2 # type: ignore
@@ -625,6 +635,10 @@ def __init__(
625635
# Initialize the universe domain validation.
626636
self._is_universe_domain_valid = False
627637

638+
if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
639+
# Setup logging.
640+
client_logging.initialize_logging()
641+
628642
api_key_value = getattr(self._client_options, "api_key", None)
629643
if api_key_value and credentials:
630644
raise ValueError(
@@ -690,14 +704,37 @@ def __init__(
690704
api_audience=self._client_options.api_audience,
691705
)
692706

707+
if "async" not in str(self._transport):
708+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
709+
std_logging.DEBUG
710+
): # pragma: NO COVER
711+
_LOGGER.debug(
712+
"Created client `google.ads.admanager_v1.AdUnitServiceClient`.",
713+
extra={
714+
"serviceName": "google.ads.admanager.v1.AdUnitService",
715+
"universeDomain": getattr(
716+
self._transport._credentials, "universe_domain", ""
717+
),
718+
"credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
719+
"credentialsInfo": getattr(
720+
self.transport._credentials, "get_cred_info", lambda: None
721+
)(),
722+
}
723+
if hasattr(self._transport, "_credentials")
724+
else {
725+
"serviceName": "google.ads.admanager.v1.AdUnitService",
726+
"credentialsType": None,
727+
},
728+
)
729+
693730
def get_ad_unit(
694731
self,
695732
request: Optional[Union[ad_unit_service.GetAdUnitRequest, dict]] = None,
696733
*,
697734
name: Optional[str] = None,
698735
retry: OptionalRetry = gapic_v1.method.DEFAULT,
699736
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
700-
metadata: Sequence[Tuple[str, str]] = (),
737+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
701738
) -> ad_unit_messages.AdUnit:
702739
r"""API to retrieve an AdUnit object.
703740
@@ -740,8 +777,10 @@ def sample_get_ad_unit():
740777
retry (google.api_core.retry.Retry): Designation of what errors, if any,
741778
should be retried.
742779
timeout (float): The timeout for this request.
743-
metadata (Sequence[Tuple[str, str]]): Strings which should be
744-
sent along with the request as metadata.
780+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
781+
sent along with the request as metadata. Normally, each value must be of type `str`,
782+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
783+
be of type `bytes`.
745784
746785
Returns:
747786
google.ads.admanager_v1.types.AdUnit:
@@ -797,7 +836,7 @@ def list_ad_units(
797836
parent: Optional[str] = None,
798837
retry: OptionalRetry = gapic_v1.method.DEFAULT,
799838
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
800-
metadata: Sequence[Tuple[str, str]] = (),
839+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
801840
) -> pagers.ListAdUnitsPager:
802841
r"""API to retrieve a list of AdUnit objects.
803842
@@ -842,8 +881,10 @@ def sample_list_ad_units():
842881
retry (google.api_core.retry.Retry): Designation of what errors, if any,
843882
should be retried.
844883
timeout (float): The timeout for this request.
845-
metadata (Sequence[Tuple[str, str]]): Strings which should be
846-
sent along with the request as metadata.
884+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
885+
sent along with the request as metadata. Normally, each value must be of type `str`,
886+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
887+
be of type `bytes`.
847888
848889
Returns:
849890
google.ads.admanager_v1.services.ad_unit_service.pagers.ListAdUnitsPager:
@@ -915,7 +956,7 @@ def list_ad_unit_sizes(
915956
parent: Optional[str] = None,
916957
retry: OptionalRetry = gapic_v1.method.DEFAULT,
917958
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
918-
metadata: Sequence[Tuple[str, str]] = (),
959+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
919960
) -> pagers.ListAdUnitSizesPager:
920961
r"""API to retrieve a list of AdUnitSize objects.
921962
@@ -960,8 +1001,10 @@ def sample_list_ad_unit_sizes():
9601001
retry (google.api_core.retry.Retry): Designation of what errors, if any,
9611002
should be retried.
9621003
timeout (float): The timeout for this request.
963-
metadata (Sequence[Tuple[str, str]]): Strings which should be
964-
sent along with the request as metadata.
1004+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1005+
sent along with the request as metadata. Normally, each value must be of type `str`,
1006+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1007+
be of type `bytes`.
9651008
9661009
Returns:
9671010
google.ads.admanager_v1.services.ad_unit_service.pagers.ListAdUnitSizesPager:
@@ -1045,7 +1088,7 @@ def get_operation(
10451088
*,
10461089
retry: OptionalRetry = gapic_v1.method.DEFAULT,
10471090
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1048-
metadata: Sequence[Tuple[str, str]] = (),
1091+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
10491092
) -> operations_pb2.Operation:
10501093
r"""Gets the latest state of a long-running operation.
10511094
@@ -1056,8 +1099,10 @@ def get_operation(
10561099
retry (google.api_core.retry.Retry): Designation of what errors,
10571100
if any, should be retried.
10581101
timeout (float): The timeout for this request.
1059-
metadata (Sequence[Tuple[str, str]]): Strings which should be
1060-
sent along with the request as metadata.
1102+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1103+
sent along with the request as metadata. Normally, each value must be of type `str`,
1104+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1105+
be of type `bytes`.
10611106
Returns:
10621107
~.operations_pb2.Operation:
10631108
An ``Operation`` object.

packages/google-ads-admanager/google/ads/admanager_v1/services/ad_unit_service/pagers.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(
6767
*,
6868
retry: OptionalRetry = gapic_v1.method.DEFAULT,
6969
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
70-
metadata: Sequence[Tuple[str, str]] = ()
70+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
7171
):
7272
"""Instantiate the pager.
7373
@@ -81,8 +81,10 @@ def __init__(
8181
retry (google.api_core.retry.Retry): Designation of what errors,
8282
if any, should be retried.
8383
timeout (float): The timeout for this request.
84-
metadata (Sequence[Tuple[str, str]]): Strings which should be
85-
sent along with the request as metadata.
84+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
85+
sent along with the request as metadata. Normally, each value must be of type `str`,
86+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
87+
be of type `bytes`.
8688
"""
8789
self._method = method
8890
self._request = ad_unit_service.ListAdUnitsRequest(request)
@@ -141,7 +143,7 @@ def __init__(
141143
*,
142144
retry: OptionalRetry = gapic_v1.method.DEFAULT,
143145
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
144-
metadata: Sequence[Tuple[str, str]] = ()
146+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
145147
):
146148
"""Instantiate the pager.
147149
@@ -155,8 +157,10 @@ def __init__(
155157
retry (google.api_core.retry.Retry): Designation of what errors,
156158
if any, should be retried.
157159
timeout (float): The timeout for this request.
158-
metadata (Sequence[Tuple[str, str]]): Strings which should be
159-
sent along with the request as metadata.
160+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
161+
sent along with the request as metadata. Normally, each value must be of type `str`,
162+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
163+
be of type `bytes`.
160164
"""
161165
self._method = method
162166
self._request = ad_unit_service.ListAdUnitSizesRequest(request)

0 commit comments

Comments
 (0)