Skip to content

Commit 6d27373

Browse files
Merge branch 'otel_publish' of https://github.com/googleapis/python-pubsub into otel_publish
2 parents 39baf61 + 72c1ee5 commit 6d27373

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

google/cloud/pubsub_v1/publisher/client.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,22 @@ def __init__(
153153

154154
# The object controlling the message publishing flow
155155
self._flow_controller = FlowController(self.publisher_options.flow_control)
156+
157+
self._open_telemetry_enabled = (
158+
self.publisher_options.enable_open_telemetry_tracing
159+
)
160+
# OpenTelemetry features used by the library are not supported in Python versions <= 3.7.
161+
# Refer https://github.com/open-telemetry/opentelemetry-python/issues/3993#issuecomment-2211976389
162+
if (
163+
self.publisher_options.enable_open_telemetry_tracing
164+
and sys.version_info.major == 3
165+
and sys.version_info.minor < 8
166+
):
167+
warnings.warn(
168+
message="Open Telemetry for Python version 3.7 or lower is not supported. Disabling Open Telemetry tracing.",
169+
category=RuntimeWarning,
170+
)
171+
self._open_telemetry_enabled = False
156172

157173
self._open_telemetry_enabled = (
158174
self.publisher_options.enable_open_telemetry_tracing

0 commit comments

Comments
 (0)