Repository navigation
Closed
Closed
Copy link
Labels
area:providerskind:featureFeature Requestsneeds-triagelabel for new issues that we didn't triage yetprovider:googleGoogle (including GCP) related issues
Description
Description
Add support for publisher_options parameter in PubSubHook to enable OpenTelemetry tracing for Pub/Sub messages via the native google-cloud-pubsub client library's enable_open_telemetry_tracing option.
Use case/motivation
Google Cloud Pub/Sub client library (v2.24.0+) supports native OpenTelemetry tracing through PublisherOptions.enable_open_telemetry_tracing. This enables distributed tracing of messages as they flow through Pub/Sub topics, which is critical for observability in event-driven architectures.
The hook already passes PublisherOptions with enable_message_ordering. Adding enable_open_telemetry_tracing would allow users to trace Pub/Sub message flows.
Current behavior:
providers/google/src/airflow/providers/google/cloud/hooks/pubsub.py
def get_conn(self) -> PublisherClient:
"""
Retrieve connection to Google Cloud Pub/Sub.
:return: Google Cloud Pub/Sub client object.
"""
if not self._client:
self._client = PublisherClient(
credentials=self.get_credentials(),
client_info=CLIENT_INFO,
publisher_options=PublisherOptions(
enable_message_ordering=self.enable_message_ordering, # No tracing enabled
),
)
return self._client
Desired behavior:
providers/google/src/airflow/providers/google/cloud/hooks/pubsub.py
def get_conn(self) -> PublisherClient:
"""
Retrieve connection to Google Cloud Pub/Sub.
:return: Google Cloud Pub/Sub client object.
"""
if not self._client:
self._client = PublisherClient(
credentials=self.get_credentials(),
client_info=CLIENT_INFO,
publisher_options=PublisherOptions(
enable_message_ordering=self.enable_message_ordering,
enable_open_telemetry_tracing=self.enable_open_telemetry_tracing # Ability to enable tracing
),
)
return self._client
Related issues
AIP-49 OpenTelemetry Support for Apache Airflow
#37628
Are you willing to submit a PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
area:providerskind:featureFeature Requestsneeds-triagelabel for new issues that we didn't triage yetprovider:googleGoogle (including GCP) related issues
Activity
boring-cyborg commentedon Nov 27, 2025
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.