Skip to content

Commit

Permalink
Add Open Telemetry data to Ack, Modack, Nack request objects
Browse files Browse the repository at this point in the history
* This is required for the Open Telemetry information to be percolated
  to the dispatcher which performs acks, nacks and modacks async.
* The Open Telemetry data passed into the dispatcher will be used to add
  events such as ack, modack, nack end to the subscribe span
  • Loading branch information
mukund-ananthu committed Sep 18, 2024
1 parent 4a5394b commit 8827117
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions google/cloud/pubsub_v1/subscriber/_protocol/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
import typing
from typing import NamedTuple, Optional

from google.cloud.pubsub_v1.open_telemetry.subscribe_opentelemetry import (
SubscribeOpenTelemetry,
)

if typing.TYPE_CHECKING: # pragma: NO COVER
from google.cloud.pubsub_v1.subscriber import futures

Expand All @@ -27,6 +31,7 @@ class AckRequest(NamedTuple):
time_to_ack: float
ordering_key: Optional[str]
future: Optional["futures.Future"]
opentelemetry_data: Optional[SubscribeOpenTelemetry] = None


class DropRequest(NamedTuple):
Expand All @@ -45,10 +50,12 @@ class ModAckRequest(NamedTuple):
ack_id: str
seconds: float
future: Optional["futures.Future"]
opentelemetry_data: Optional[SubscribeOpenTelemetry] = None


class NackRequest(NamedTuple):
ack_id: str
byte_size: int
ordering_key: Optional[str]
future: Optional["futures.Future"]
opentelemetry_data: Optional[SubscribeOpenTelemetry] = None

0 comments on commit 8827117

Please sign in to comment.