Repository navigation
Conversation
feywind
added this pull request to stack #9467
September 29, 2026 02:09
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces telemetry and logging support for hedged publishing in the Pub/Sub client. Specifically, it adds a new sublog 'publishHedged' to the message queue logs, implements 'publishStartHedged' and 'publishEndHedged' event tracking methods in 'PubsubEvents', and includes corresponding unit tests to verify that these new hedged events are correctly recorded on the publisher span. There are no review comments to address.
This was referenced Sep 29, 2026
feywind
force-pushed
the
pubsub/hedging-telemetry-and-logging
branch
from
September 29, 2026 03:05
da7f7ca to
a03985e
Compare
feywind
force-pushed
the
pubsub/hedging-telemetry-and-logging
branch
from
October 13, 2026 18:36
a03985e to
5087464
Compare
feywind
force-pushed
the
pubsub/hedging-telemetry-and-logging
branch
2 times, most recently
from
October 13, 2026 21:59
2fb0b0c to
b196d35
Compare
feywind
force-pushed
the
pubsub/hedging-telemetry-and-logging
branch
from
October 13, 2026 22:09
b196d35 to
03711de
Compare
This was referenced Oct 15, 2026
feywind
marked this pull request as ready for review
October 15, 2026 21:33
feywind
force-pushed
the
pubsub/hedging-telemetry-and-logging
branch
from
October 19, 2026 21:57
03711de to
c001507
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR is Layer 4 of 7 in Stack #9467, which implements Publish Hedging for
@google-cloud/pubsubto mitigate high-percentile (p99/p99.9) publish tail latencies by sending backup (hedged) publish RPCs when an in-flight batch takes longer than a configurablehedgeDelaythreshold.Stack Structure
feat(gax): support AbortSignal cancellation in CallOptions and createApiCallfeat(pubsub): add HedgingOptions validation and HedgingTokenBucketfeat(pubsub): add CancellationSharer and HedgingSchedulerfeat(pubsub): add OpenTelemetry events and logging for hedged publish(this PR)feat(pubsub): integrate publish hedging into MessageQueuetest(pubsub): add unit tests for publish hedging queue integrationtest(pubsub): add publish hedging system testsSummary of Changes in This PR
This layer adds OpenTelemetry span events and debug sub-logging for hedged publish attempts, matching the event names used in the Java client implementation:
handwritten/pubsub/src/telemetry-tracing.ts):PubsubEvents.publishStartHedged(message)- records'publish start (hedged)'on the message'sparentSpanwhen a hedged attempt is dispatched.PubsubEvents.publishEndHedged(message)- records'publish end (hedged)'on the message'sparentSpanwhen a hedged attempt wins the race.handwritten/pubsub/src/publisher/message-queues.ts):logs.publishHedged = baseLogs.pubsub.sublog('publish-hedged')for logging hedged attempt dispatches and token-bucket rate limiting.handwritten/pubsub/test/telemetry-tracing.ts):publishStartHedgedandpublishEndHedgedrecord the expected span events on producer spans.