google-cloud-pubsub 2.34.0__tar.gz → 2.36.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_cloud_pubsub-2.34.0/google_cloud_pubsub.egg-info → google_cloud_pubsub-2.36.0}/PKG-INFO +150 -47
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/README.rst +141 -32
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub/__init__.py +6 -5
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/__init__.py +1 -3
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/exceptions.py +0 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/open_telemetry/context_propagation.py +2 -2
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/open_telemetry/subscribe_opentelemetry.py +6 -6
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/__init__.py +0 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_batch/base.py +0 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_batch/thread.py +12 -14
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_sequencer/base.py +2 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_sequencer/ordered_sequencer.py +12 -13
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_sequencer/unordered_sequencer.py +3 -5
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/client.py +10 -9
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/exceptions.py +1 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/flow_controller.py +5 -5
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/__init__.py +0 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/dispatcher.py +24 -25
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/helper_threads.py +1 -2
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py +0 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/messages_on_hold.py +3 -3
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py +24 -23
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/client.py +4 -4
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/exceptions.py +2 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/futures.py +1 -2
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/message.py +7 -6
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/types.py +13 -11
- google_cloud_pubsub-2.36.0/google/pubsub/__init__.py +181 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub/gapic_version.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/__init__.py +83 -78
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/gapic_version.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/async_client.py +32 -24
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/client.py +31 -40
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/pagers.py +12 -11
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/__init__.py +1 -3
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/base.py +15 -11
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/grpc.py +11 -10
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/grpc_asyncio.py +12 -11
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/rest.py +19 -23
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/rest_base.py +9 -9
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/async_client.py +22 -13
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/client.py +27 -23
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/pagers.py +10 -9
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/__init__.py +1 -3
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/base.py +15 -11
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/grpc.py +11 -10
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/grpc_asyncio.py +12 -11
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/rest.py +18 -28
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/rest_base.py +9 -9
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/async_client.py +30 -21
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/client.py +29 -35
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/pagers.py +10 -9
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/__init__.py +1 -3
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/base.py +15 -11
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/grpc.py +11 -10
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/grpc_asyncio.py +12 -11
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/rest.py +19 -23
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/rest_base.py +9 -9
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/types/__init__.py +6 -2
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/types/pubsub.py +256 -14
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/types/schema.py +4 -3
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0/google_cloud_pubsub.egg-info}/PKG-INFO +150 -47
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/requires.txt +5 -17
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/setup.py +18 -23
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/system.py +8 -18
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/pubsub_v1/test_publisher.py +53 -53
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/pubsub_v1/test_schema_service.py +56 -56
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/pubsub_v1/test_subscriber.py +99 -103
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/batch/test_base.py +5 -6
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/batch/test_thread.py +13 -18
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/sequencer/test_ordered_sequencer.py +4 -10
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/sequencer/test_unordered_sequencer.py +6 -12
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/test_flow_controller.py +1 -3
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/test_publisher_client.py +12 -22
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_dispatcher.py +10 -14
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_futures_subscriber.py +1 -6
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_heartbeater.py +6 -10
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_helper_threads.py +1 -8
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_leaser.py +10 -14
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_message.py +7 -13
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_scheduler.py +3 -9
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py +20 -32
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_subscribe_opentelemetry.py +6 -12
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_subscriber_client.py +6 -13
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/test_futures.py +2 -8
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/test_pubsub.py +1 -2
- google_cloud_pubsub-2.34.0/google/pubsub/__init__.py +0 -174
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/LICENSE +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/MANIFEST.in +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/futures.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/open_telemetry/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/open_telemetry/publish_message_wrapper.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/proto/pubsub.proto +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/proto/schema.proto +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_batch/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_sequencer/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/futures.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/requests.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/scheduler.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub/py.typed +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/gapic_metadata.json +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/py.typed +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/__init__.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/__init__.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/__init__.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/SOURCES.txt +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/dependency_links.txt +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/not-zip-safe +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/top_level.txt +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/setup.cfg +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/pubsub_v1/__init__.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/conftest.py +4 -4
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/test_futures_publisher.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/test_publish_message_wrapper.py +1 -1
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_histogram.py +0 -0
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_messages_on_hold.py +3 -3
- {google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/tests/unit/test_packaging.py +0 -0
{google_cloud_pubsub-2.34.0/google_cloud_pubsub.egg-info → google_cloud_pubsub-2.36.0}/PKG-INFO
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-cloud-pubsub
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.36.0
|
|
4
4
|
Summary: Google Cloud Pub/Sub API client library
|
|
5
|
-
Home-page: https://github.com/googleapis/python-pubsub
|
|
5
|
+
Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-pubsub
|
|
6
6
|
Author: Google LLC
|
|
7
7
|
Author-email: googleapis-packages@google.com
|
|
8
8
|
License: Apache 2.0
|
|
@@ -12,8 +12,6 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -22,22 +20,18 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
22
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
21
|
Classifier: Operating System :: OS Independent
|
|
24
22
|
Classifier: Topic :: Internet
|
|
25
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.9
|
|
26
24
|
License-File: LICENSE
|
|
27
|
-
Requires-Dist: grpcio<2.0.0,>=1.51.3; python_version < "3.14"
|
|
28
|
-
Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
|
|
29
|
-
Requires-Dist: google-auth<3.0.0,>=2.14.1
|
|
30
25
|
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
|
|
27
|
+
Requires-Dist: grpcio<2.0.0,>=1.51.3; python_version < "3.14"
|
|
28
|
+
Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
33
29
|
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
34
30
|
Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2
|
|
35
|
-
Requires-Dist: grpc-google-iam-v1<1.0.0,>=0.
|
|
31
|
+
Requires-Dist: grpc-google-iam-v1<1.0.0,>=0.14.0
|
|
36
32
|
Requires-Dist: grpcio-status>=1.33.2
|
|
37
|
-
Requires-Dist: opentelemetry-api
|
|
38
|
-
Requires-Dist: opentelemetry-
|
|
39
|
-
Requires-Dist: opentelemetry-sdk<=1.22.0; python_version <= "3.7"
|
|
40
|
-
Requires-Dist: opentelemetry-sdk>=1.27.0; python_version >= "3.8"
|
|
33
|
+
Requires-Dist: opentelemetry-api>=1.27.0
|
|
34
|
+
Requires-Dist: opentelemetry-sdk>=1.27.0
|
|
41
35
|
Provides-Extra: libcst
|
|
42
36
|
Requires-Dist: libcst>=0.3.10; extra == "libcst"
|
|
43
37
|
Dynamic: author
|
|
@@ -53,12 +47,12 @@ Dynamic: requires-dist
|
|
|
53
47
|
Dynamic: requires-python
|
|
54
48
|
Dynamic: summary
|
|
55
49
|
|
|
56
|
-
Python Client for Google Cloud Pub
|
|
57
|
-
|
|
50
|
+
Python Client for Google Cloud Pub/Sub
|
|
51
|
+
======================================
|
|
58
52
|
|
|
59
|
-
|
|
|
53
|
+
|stable| |pypi| |versions|
|
|
60
54
|
|
|
61
|
-
|
|
55
|
+
'Google Cloud Pub/Sub:' is a fully-managed real-time messaging service that
|
|
62
56
|
allows you to send and receive messages between independent applications. You
|
|
63
57
|
can leverage Cloud Pub/Sub’s flexibility to decouple systems and components
|
|
64
58
|
hosted on Google Cloud Platform or elsewhere on the Internet. By building on
|
|
@@ -71,18 +65,18 @@ can subscribe to that topic to receive the messages. By decoupling senders and
|
|
|
71
65
|
receivers, Google Cloud Pub/Sub allows developers to communicate between
|
|
72
66
|
independently written applications.
|
|
73
67
|
|
|
74
|
-
- `Product Documentation`_
|
|
75
68
|
- `Client Library Documentation`_
|
|
69
|
+
- `Product Documentation`_
|
|
76
70
|
|
|
77
|
-
.. |
|
|
78
|
-
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#
|
|
71
|
+
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
|
|
72
|
+
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
|
|
79
73
|
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-pubsub.svg
|
|
80
74
|
:target: https://pypi.org/project/google-cloud-pubsub/
|
|
81
75
|
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-pubsub.svg
|
|
82
76
|
:target: https://pypi.org/project/google-cloud-pubsub/
|
|
83
|
-
.. _Google Cloud Pub
|
|
84
|
-
..
|
|
85
|
-
..
|
|
77
|
+
.. _Google Cloud Pub/Sub: https://cloud.google.com/pubsub/docs/
|
|
78
|
+
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/pubsub/latest
|
|
79
|
+
.. _Product Documentation: https://cloud.google.com/pubsub/docs/
|
|
86
80
|
|
|
87
81
|
Quick Start
|
|
88
82
|
-----------
|
|
@@ -91,48 +85,57 @@ In order to use this library, you first need to go through the following steps:
|
|
|
91
85
|
|
|
92
86
|
1. `Select or create a Cloud Platform project.`_
|
|
93
87
|
2. `Enable billing for your project.`_
|
|
94
|
-
3. `Enable the Google Cloud Pub
|
|
95
|
-
4. `
|
|
88
|
+
3. `Enable the Google Cloud Pub/Sub.`_
|
|
89
|
+
4. `Set up Authentication.`_
|
|
96
90
|
|
|
97
91
|
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
|
|
98
92
|
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
|
|
99
|
-
.. _Enable the Google Cloud Pub
|
|
100
|
-
..
|
|
93
|
+
.. _Enable the Google Cloud Pub/Sub.: https://cloud.google.com/pubsub/docs/
|
|
94
|
+
.. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
|
|
101
95
|
|
|
102
96
|
Installation
|
|
103
97
|
~~~~~~~~~~~~
|
|
104
98
|
|
|
105
|
-
Install this library in a `
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
Install this library in a virtual environment using `venv`_. `venv`_ is a tool that
|
|
100
|
+
creates isolated Python environments. These isolated environments can have separate
|
|
101
|
+
versions of Python packages, which allows you to isolate one project's dependencies
|
|
102
|
+
from the dependencies of other projects.
|
|
108
103
|
|
|
109
|
-
With `
|
|
104
|
+
With `venv`_, it's possible to install this library without needing system
|
|
110
105
|
install permissions, and without clashing with the installed system
|
|
111
106
|
dependencies.
|
|
112
107
|
|
|
113
|
-
.. _`
|
|
108
|
+
.. _`venv`: https://docs.python.org/3/library/venv.html
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
Code samples and snippets
|
|
112
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
113
|
+
|
|
114
|
+
Code samples and snippets live in the `samples/`_ folder.
|
|
115
|
+
|
|
116
|
+
.. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-pubsub/samples
|
|
114
117
|
|
|
115
118
|
|
|
116
119
|
Supported Python Versions
|
|
117
120
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
118
|
-
Python >= 3.
|
|
121
|
+
Python >= 3.9
|
|
119
122
|
|
|
120
123
|
Deprecated Python Versions
|
|
121
124
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
122
|
-
Python
|
|
125
|
+
Python < 3.9
|
|
123
126
|
|
|
124
|
-
The last version of this library compatible with Python
|
|
127
|
+
The last version of this library compatible with Python 3.7 and 3.8 is google-cloud-pubsub==2.34.0.
|
|
125
128
|
|
|
129
|
+
The last version of this library compatible with Python 2.7 is google-cloud-pubsub==1.7.0.
|
|
126
130
|
|
|
127
131
|
Mac/Linux
|
|
128
132
|
^^^^^^^^^
|
|
129
133
|
|
|
130
134
|
.. code-block:: console
|
|
131
135
|
|
|
132
|
-
|
|
133
|
-
virtualenv <your-env>
|
|
136
|
+
python3 -m venv <your-env>
|
|
134
137
|
source <your-env>/bin/activate
|
|
135
|
-
|
|
138
|
+
pip install google-cloud-pubsub
|
|
136
139
|
|
|
137
140
|
|
|
138
141
|
Windows
|
|
@@ -140,11 +143,9 @@ Windows
|
|
|
140
143
|
|
|
141
144
|
.. code-block:: console
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<your-env>\Scripts\pip.exe install google-cloud-pubsub
|
|
147
|
-
|
|
146
|
+
py -m venv <your-env>
|
|
147
|
+
.\<your-env>\Scripts\activate
|
|
148
|
+
pip install google-cloud-pubsub
|
|
148
149
|
|
|
149
150
|
Example Usage
|
|
150
151
|
~~~~~~~~~~~~~
|
|
@@ -201,7 +202,7 @@ the topic, and subscribe to that, passing a callback function.
|
|
|
201
202
|
|
|
202
203
|
with pubsub_v1.SubscriberClient() as subscriber:
|
|
203
204
|
subscriber.create_subscription(
|
|
204
|
-
name=subscription_name, topic=topic_name)
|
|
205
|
+
name=subscription_name, topic=topic_name)
|
|
205
206
|
future = subscriber.subscribe(subscription_name, callback)
|
|
206
207
|
|
|
207
208
|
The future returned by the call to ``subscriber.subscribe`` can be used to
|
|
@@ -245,7 +246,7 @@ For example, to use JSON Web Tokens, provide a `google.auth.jwt.Credentials`_ in
|
|
|
245
246
|
|
|
246
247
|
# The same for the publisher, except that the "audience" claim needs to be adjusted
|
|
247
248
|
publisher_audience = "https://pubsub.googleapis.com/google.pubsub.v1.Publisher"
|
|
248
|
-
credentials_pub = credentials.with_claims(audience=publisher_audience)
|
|
249
|
+
credentials_pub = credentials.with_claims(audience=publisher_audience)
|
|
249
250
|
publisher = pubsub_v1.PublisherClient(credentials=credentials_pub)
|
|
250
251
|
|
|
251
252
|
.. _Credentials: https://google-auth.readthedocs.io/en/latest/reference/google.auth.credentials.html#google.auth.credentials.Credentials
|
|
@@ -283,3 +284,105 @@ License
|
|
|
283
284
|
Apache 2.0 - See `the LICENSE`_ for more information.
|
|
284
285
|
|
|
285
286
|
.. _the LICENSE: https://github.com/googleapis/google-cloud-python/blob/main/LICENSE
|
|
287
|
+
|
|
288
|
+
Next Steps
|
|
289
|
+
~~~~~~~~~~
|
|
290
|
+
|
|
291
|
+
- Read the `Client Library Documentation`_ for Google Cloud Pub/Sub
|
|
292
|
+
to see other available methods on the client.
|
|
293
|
+
- Read the `Google Cloud Pub/Sub Product documentation`_ to learn
|
|
294
|
+
more about the product and see How-to Guides.
|
|
295
|
+
- View this `README`_ to see the full list of Cloud
|
|
296
|
+
APIs that we cover.
|
|
297
|
+
|
|
298
|
+
.. _Google Cloud Pub/Sub Product documentation: https://cloud.google.com/pubsub/docs/
|
|
299
|
+
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
|
|
300
|
+
|
|
301
|
+
Logging
|
|
302
|
+
-------
|
|
303
|
+
|
|
304
|
+
This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
|
|
305
|
+
Note the following:
|
|
306
|
+
|
|
307
|
+
#. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging.
|
|
308
|
+
#. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**.
|
|
309
|
+
#. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
|
|
310
|
+
|
|
311
|
+
Simple, environment-based configuration
|
|
312
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
313
|
+
|
|
314
|
+
To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google
|
|
315
|
+
logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged
|
|
316
|
+
messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
|
|
317
|
+
event.
|
|
318
|
+
|
|
319
|
+
A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
|
|
320
|
+
|
|
321
|
+
- Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
|
|
322
|
+
- Invalid logging scopes: :code:`foo`, :code:`123`, etc.
|
|
323
|
+
|
|
324
|
+
**NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
|
|
325
|
+
|
|
326
|
+
Environment-Based Examples
|
|
327
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
328
|
+
|
|
329
|
+
- Enabling the default handler for all Google-based loggers
|
|
330
|
+
|
|
331
|
+
.. code-block:: console
|
|
332
|
+
|
|
333
|
+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
|
|
334
|
+
|
|
335
|
+
- Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
|
|
336
|
+
|
|
337
|
+
.. code-block:: console
|
|
338
|
+
|
|
339
|
+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
Advanced, code-based configuration
|
|
343
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
344
|
+
|
|
345
|
+
You can also configure a valid logging scope using Python's standard `logging` mechanism.
|
|
346
|
+
|
|
347
|
+
Code-Based Examples
|
|
348
|
+
^^^^^^^^^^^^^^^^^^^
|
|
349
|
+
|
|
350
|
+
- Configuring a handler for all Google-based loggers
|
|
351
|
+
|
|
352
|
+
.. code-block:: python
|
|
353
|
+
|
|
354
|
+
import logging
|
|
355
|
+
|
|
356
|
+
from google.cloud import library_v1
|
|
357
|
+
|
|
358
|
+
base_logger = logging.getLogger("google")
|
|
359
|
+
base_logger.addHandler(logging.StreamHandler())
|
|
360
|
+
base_logger.setLevel(logging.DEBUG)
|
|
361
|
+
|
|
362
|
+
- Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
|
|
363
|
+
|
|
364
|
+
.. code-block:: python
|
|
365
|
+
|
|
366
|
+
import logging
|
|
367
|
+
|
|
368
|
+
from google.cloud import library_v1
|
|
369
|
+
|
|
370
|
+
base_logger = logging.getLogger("google.cloud.library_v1")
|
|
371
|
+
base_logger.addHandler(logging.StreamHandler())
|
|
372
|
+
base_logger.setLevel(logging.DEBUG)
|
|
373
|
+
|
|
374
|
+
Logging details
|
|
375
|
+
~~~~~~~~~~~~~~~
|
|
376
|
+
|
|
377
|
+
#. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root
|
|
378
|
+
logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
|
|
379
|
+
:code:`logging.getLogger("google").propagate = True` in your code.
|
|
380
|
+
#. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
|
|
381
|
+
one library, but decide you need to also set up environment-based logging configuration for another library.
|
|
382
|
+
|
|
383
|
+
#. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
|
|
384
|
+
if the code -based configuration gets applied first.
|
|
385
|
+
|
|
386
|
+
#. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
|
|
387
|
+
executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
|
|
388
|
+
(This is the reason for 2.i. above.)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Python Client for Google Cloud Pub
|
|
2
|
-
|
|
1
|
+
Python Client for Google Cloud Pub/Sub
|
|
2
|
+
======================================
|
|
3
3
|
|
|
4
|
-
|
|
|
4
|
+
|stable| |pypi| |versions|
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
'Google Cloud Pub/Sub:' is a fully-managed real-time messaging service that
|
|
7
7
|
allows you to send and receive messages between independent applications. You
|
|
8
8
|
can leverage Cloud Pub/Sub’s flexibility to decouple systems and components
|
|
9
9
|
hosted on Google Cloud Platform or elsewhere on the Internet. By building on
|
|
@@ -16,18 +16,18 @@ can subscribe to that topic to receive the messages. By decoupling senders and
|
|
|
16
16
|
receivers, Google Cloud Pub/Sub allows developers to communicate between
|
|
17
17
|
independently written applications.
|
|
18
18
|
|
|
19
|
-
- `Product Documentation`_
|
|
20
19
|
- `Client Library Documentation`_
|
|
20
|
+
- `Product Documentation`_
|
|
21
21
|
|
|
22
|
-
.. |
|
|
23
|
-
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#
|
|
22
|
+
.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
|
|
23
|
+
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
|
|
24
24
|
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-pubsub.svg
|
|
25
25
|
:target: https://pypi.org/project/google-cloud-pubsub/
|
|
26
26
|
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-pubsub.svg
|
|
27
27
|
:target: https://pypi.org/project/google-cloud-pubsub/
|
|
28
|
-
.. _Google Cloud Pub
|
|
29
|
-
..
|
|
30
|
-
..
|
|
28
|
+
.. _Google Cloud Pub/Sub: https://cloud.google.com/pubsub/docs/
|
|
29
|
+
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/pubsub/latest
|
|
30
|
+
.. _Product Documentation: https://cloud.google.com/pubsub/docs/
|
|
31
31
|
|
|
32
32
|
Quick Start
|
|
33
33
|
-----------
|
|
@@ -36,48 +36,57 @@ In order to use this library, you first need to go through the following steps:
|
|
|
36
36
|
|
|
37
37
|
1. `Select or create a Cloud Platform project.`_
|
|
38
38
|
2. `Enable billing for your project.`_
|
|
39
|
-
3. `Enable the Google Cloud Pub
|
|
40
|
-
4. `
|
|
39
|
+
3. `Enable the Google Cloud Pub/Sub.`_
|
|
40
|
+
4. `Set up Authentication.`_
|
|
41
41
|
|
|
42
42
|
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
|
|
43
43
|
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
|
|
44
|
-
.. _Enable the Google Cloud Pub
|
|
45
|
-
..
|
|
44
|
+
.. _Enable the Google Cloud Pub/Sub.: https://cloud.google.com/pubsub/docs/
|
|
45
|
+
.. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
|
|
46
46
|
|
|
47
47
|
Installation
|
|
48
48
|
~~~~~~~~~~~~
|
|
49
49
|
|
|
50
|
-
Install this library in a `
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
Install this library in a virtual environment using `venv`_. `venv`_ is a tool that
|
|
51
|
+
creates isolated Python environments. These isolated environments can have separate
|
|
52
|
+
versions of Python packages, which allows you to isolate one project's dependencies
|
|
53
|
+
from the dependencies of other projects.
|
|
53
54
|
|
|
54
|
-
With `
|
|
55
|
+
With `venv`_, it's possible to install this library without needing system
|
|
55
56
|
install permissions, and without clashing with the installed system
|
|
56
57
|
dependencies.
|
|
57
58
|
|
|
58
|
-
.. _`
|
|
59
|
+
.. _`venv`: https://docs.python.org/3/library/venv.html
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Code samples and snippets
|
|
63
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
64
|
+
|
|
65
|
+
Code samples and snippets live in the `samples/`_ folder.
|
|
66
|
+
|
|
67
|
+
.. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-pubsub/samples
|
|
59
68
|
|
|
60
69
|
|
|
61
70
|
Supported Python Versions
|
|
62
71
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
63
|
-
Python >= 3.
|
|
72
|
+
Python >= 3.9
|
|
64
73
|
|
|
65
74
|
Deprecated Python Versions
|
|
66
75
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
67
|
-
Python
|
|
76
|
+
Python < 3.9
|
|
68
77
|
|
|
69
|
-
The last version of this library compatible with Python
|
|
78
|
+
The last version of this library compatible with Python 3.7 and 3.8 is google-cloud-pubsub==2.34.0.
|
|
70
79
|
|
|
80
|
+
The last version of this library compatible with Python 2.7 is google-cloud-pubsub==1.7.0.
|
|
71
81
|
|
|
72
82
|
Mac/Linux
|
|
73
83
|
^^^^^^^^^
|
|
74
84
|
|
|
75
85
|
.. code-block:: console
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
virtualenv <your-env>
|
|
87
|
+
python3 -m venv <your-env>
|
|
79
88
|
source <your-env>/bin/activate
|
|
80
|
-
|
|
89
|
+
pip install google-cloud-pubsub
|
|
81
90
|
|
|
82
91
|
|
|
83
92
|
Windows
|
|
@@ -85,11 +94,9 @@ Windows
|
|
|
85
94
|
|
|
86
95
|
.. code-block:: console
|
|
87
96
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
<your-env>\Scripts\pip.exe install google-cloud-pubsub
|
|
92
|
-
|
|
97
|
+
py -m venv <your-env>
|
|
98
|
+
.\<your-env>\Scripts\activate
|
|
99
|
+
pip install google-cloud-pubsub
|
|
93
100
|
|
|
94
101
|
Example Usage
|
|
95
102
|
~~~~~~~~~~~~~
|
|
@@ -146,7 +153,7 @@ the topic, and subscribe to that, passing a callback function.
|
|
|
146
153
|
|
|
147
154
|
with pubsub_v1.SubscriberClient() as subscriber:
|
|
148
155
|
subscriber.create_subscription(
|
|
149
|
-
name=subscription_name, topic=topic_name)
|
|
156
|
+
name=subscription_name, topic=topic_name)
|
|
150
157
|
future = subscriber.subscribe(subscription_name, callback)
|
|
151
158
|
|
|
152
159
|
The future returned by the call to ``subscriber.subscribe`` can be used to
|
|
@@ -190,7 +197,7 @@ For example, to use JSON Web Tokens, provide a `google.auth.jwt.Credentials`_ in
|
|
|
190
197
|
|
|
191
198
|
# The same for the publisher, except that the "audience" claim needs to be adjusted
|
|
192
199
|
publisher_audience = "https://pubsub.googleapis.com/google.pubsub.v1.Publisher"
|
|
193
|
-
credentials_pub = credentials.with_claims(audience=publisher_audience)
|
|
200
|
+
credentials_pub = credentials.with_claims(audience=publisher_audience)
|
|
194
201
|
publisher = pubsub_v1.PublisherClient(credentials=credentials_pub)
|
|
195
202
|
|
|
196
203
|
.. _Credentials: https://google-auth.readthedocs.io/en/latest/reference/google.auth.credentials.html#google.auth.credentials.Credentials
|
|
@@ -228,3 +235,105 @@ License
|
|
|
228
235
|
Apache 2.0 - See `the LICENSE`_ for more information.
|
|
229
236
|
|
|
230
237
|
.. _the LICENSE: https://github.com/googleapis/google-cloud-python/blob/main/LICENSE
|
|
238
|
+
|
|
239
|
+
Next Steps
|
|
240
|
+
~~~~~~~~~~
|
|
241
|
+
|
|
242
|
+
- Read the `Client Library Documentation`_ for Google Cloud Pub/Sub
|
|
243
|
+
to see other available methods on the client.
|
|
244
|
+
- Read the `Google Cloud Pub/Sub Product documentation`_ to learn
|
|
245
|
+
more about the product and see How-to Guides.
|
|
246
|
+
- View this `README`_ to see the full list of Cloud
|
|
247
|
+
APIs that we cover.
|
|
248
|
+
|
|
249
|
+
.. _Google Cloud Pub/Sub Product documentation: https://cloud.google.com/pubsub/docs/
|
|
250
|
+
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
|
|
251
|
+
|
|
252
|
+
Logging
|
|
253
|
+
-------
|
|
254
|
+
|
|
255
|
+
This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
|
|
256
|
+
Note the following:
|
|
257
|
+
|
|
258
|
+
#. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging.
|
|
259
|
+
#. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**.
|
|
260
|
+
#. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
|
|
261
|
+
|
|
262
|
+
Simple, environment-based configuration
|
|
263
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
264
|
+
|
|
265
|
+
To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google
|
|
266
|
+
logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged
|
|
267
|
+
messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
|
|
268
|
+
event.
|
|
269
|
+
|
|
270
|
+
A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
|
|
271
|
+
|
|
272
|
+
- Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
|
|
273
|
+
- Invalid logging scopes: :code:`foo`, :code:`123`, etc.
|
|
274
|
+
|
|
275
|
+
**NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
|
|
276
|
+
|
|
277
|
+
Environment-Based Examples
|
|
278
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
279
|
+
|
|
280
|
+
- Enabling the default handler for all Google-based loggers
|
|
281
|
+
|
|
282
|
+
.. code-block:: console
|
|
283
|
+
|
|
284
|
+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
|
|
285
|
+
|
|
286
|
+
- Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
|
|
287
|
+
|
|
288
|
+
.. code-block:: console
|
|
289
|
+
|
|
290
|
+
export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
Advanced, code-based configuration
|
|
294
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
295
|
+
|
|
296
|
+
You can also configure a valid logging scope using Python's standard `logging` mechanism.
|
|
297
|
+
|
|
298
|
+
Code-Based Examples
|
|
299
|
+
^^^^^^^^^^^^^^^^^^^
|
|
300
|
+
|
|
301
|
+
- Configuring a handler for all Google-based loggers
|
|
302
|
+
|
|
303
|
+
.. code-block:: python
|
|
304
|
+
|
|
305
|
+
import logging
|
|
306
|
+
|
|
307
|
+
from google.cloud import library_v1
|
|
308
|
+
|
|
309
|
+
base_logger = logging.getLogger("google")
|
|
310
|
+
base_logger.addHandler(logging.StreamHandler())
|
|
311
|
+
base_logger.setLevel(logging.DEBUG)
|
|
312
|
+
|
|
313
|
+
- Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
|
|
314
|
+
|
|
315
|
+
.. code-block:: python
|
|
316
|
+
|
|
317
|
+
import logging
|
|
318
|
+
|
|
319
|
+
from google.cloud import library_v1
|
|
320
|
+
|
|
321
|
+
base_logger = logging.getLogger("google.cloud.library_v1")
|
|
322
|
+
base_logger.addHandler(logging.StreamHandler())
|
|
323
|
+
base_logger.setLevel(logging.DEBUG)
|
|
324
|
+
|
|
325
|
+
Logging details
|
|
326
|
+
~~~~~~~~~~~~~~~
|
|
327
|
+
|
|
328
|
+
#. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root
|
|
329
|
+
logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
|
|
330
|
+
:code:`logging.getLogger("google").propagate = True` in your code.
|
|
331
|
+
#. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
|
|
332
|
+
one library, but decide you need to also set up environment-based logging configuration for another library.
|
|
333
|
+
|
|
334
|
+
#. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
|
|
335
|
+
if the code -based configuration gets applied first.
|
|
336
|
+
|
|
337
|
+
#. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
|
|
338
|
+
executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
|
|
339
|
+
(This is the reason for 2.i. above.)
|
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
from __future__ import absolute_import
|
|
19
19
|
|
|
20
|
-
from google.cloud.pubsub_v1 import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
from google.cloud.pubsub_v1 import (
|
|
21
|
+
PublisherClient,
|
|
22
|
+
SchemaServiceClient,
|
|
23
|
+
SubscriberClient,
|
|
24
|
+
types,
|
|
25
|
+
)
|
|
25
26
|
|
|
26
27
|
__all__ = (
|
|
27
28
|
"types",
|
{google_cloud_pubsub-2.34.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/__init__.py
RENAMED
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import absolute_import
|
|
16
16
|
|
|
17
|
-
from google.cloud.pubsub_v1 import types
|
|
18
|
-
from google.cloud.pubsub_v1 import publisher
|
|
19
|
-
from google.cloud.pubsub_v1 import subscriber
|
|
17
|
+
from google.cloud.pubsub_v1 import publisher, subscriber, types
|
|
20
18
|
from google.pubsub_v1.services import schema_service
|
|
21
19
|
|
|
22
20
|
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from typing import
|
|
15
|
+
from typing import List, Optional
|
|
16
16
|
|
|
17
|
-
from opentelemetry.propagators.textmap import
|
|
17
|
+
from opentelemetry.propagators.textmap import Getter, Setter
|
|
18
18
|
|
|
19
19
|
from google.pubsub_v1 import PubsubMessage
|
|
20
20
|
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from typing import Optional, List
|
|
16
15
|
from datetime import datetime
|
|
16
|
+
from typing import List, Optional
|
|
17
17
|
|
|
18
|
-
from opentelemetry import
|
|
19
|
-
from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
|
|
18
|
+
from opentelemetry import context, trace
|
|
20
19
|
from opentelemetry.trace.propagation import set_span_in_context
|
|
20
|
+
from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
|
|
21
21
|
|
|
22
22
|
from google.cloud.pubsub_v1.open_telemetry.context_propagation import (
|
|
23
23
|
OpenTelemetryContextGetter,
|
|
@@ -168,9 +168,9 @@ class SubscribeOpenTelemetry:
|
|
|
168
168
|
publish_create_span: trace.Span = trace.get_current_span(
|
|
169
169
|
self._publisher_create_span_context
|
|
170
170
|
)
|
|
171
|
-
span_context: Optional[
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
span_context: Optional[trace.SpanContext] = (
|
|
172
|
+
publish_create_span.get_span_context()
|
|
173
|
+
)
|
|
174
174
|
publish_create_span_link = (
|
|
175
175
|
trace.Link(span_context) if span_context else None
|
|
176
176
|
)
|