Skip to content

feat(pubsub): include subscription name in StreamingPull header#4585

Open
haphungw wants to merge 1 commit intogoogleapis:mainfrom
haphungw:streaming-pull-routing-header
Open

feat(pubsub): include subscription name in StreamingPull header#4585
haphungw wants to merge 1 commit intogoogleapis:mainfrom
haphungw:streaming-pull-routing-header

Conversation

@haphungw
Copy link
Contributor

@haphungw haphungw commented Feb 6, 2026

Fix #4470

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Feb 6, 2026
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.02%. Comparing base (76753ba) to head (a06c971).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4585      +/-   ##
==========================================
+ Coverage   95.01%   95.02%   +0.01%     
==========================================
  Files         195      195              
  Lines        7456     7459       +3     
==========================================
+ Hits         7084     7088       +4     
+ Misses        372      371       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@haphungw haphungw marked this pull request as ready for review February 6, 2026 00:23
@haphungw haphungw requested a review from a team as a code owner February 6, 2026 00:23
Copy link
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we test this so the code doesn't regress?

I have an idea (SPOILERS)

We have a mock Pub/Sub service ...

request: tonic::Request<mpsc::Receiver<tonic::Result<v1::StreamingPullRequest>>>,

... which we use in the session.rs unit tests. Maybe we can add a new unit test where we extract the metadata from the incoming tonic::Request and check that it has the header we just set?

https://docs.rs/tonic/0.14.2/tonic/struct.Request.html#method.metadata

type Stream = MockStream;
async fn streaming_pull(
&self,
subscription: &str,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: This works, and I am ok with it.

Some background: this is a handwritten interface for a bidirectional gRPC stream added onto a fully generated struct.

We have not come up with a generic solution for bidirectional streams yet that we can generate.

So subscription works but it won't help us solve the general problem. (Which might look like accepting an initial request? (although I don't think in general that is even known. Ugh. It is a hard problem that probably @coryan will have to tackle next quarter)).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider accepting the whole x_goog_request_params

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsub Issues related to the Pub/Sub API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set routing header for StreamingPull RPC

2 participants