Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pubsub: extract trace information on push subscriptions #10828

Closed
radhus opened this issue Sep 5, 2024 · 1 comment · Fixed by #10827
Closed

pubsub: extract trace information on push subscriptions #10828

radhus opened this issue Sep 5, 2024 · 1 comment · Fixed by #10827
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. triage me I really want to be triaged.

Comments

@radhus
Copy link
Contributor

radhus commented Sep 5, 2024

Is your feature request related to a problem? Please describe.

As of pubsub v1.42.0 and PR #10709 we now have OpenTelemetry tracing with spans propagating over publishers and pull subscribers! This is a very welcomed feature that will be very useful for understanding and debugging distributed systems.

However, there is currently no support in this library to extract the trace information when using HTTP push subscriptions.

Describe the solution you'd like

When receiving pubsub messages on a HTTP push endpoint, it would be nice to end up with a context which has the tracing information extracted from the pubsub message (specifically from its attributes, as it is implemented now).

We have a library that helps us handle pubsub push endpoints where we'd like to implement the trace extraction: cloudpubsub in our cloudrunner-go package (Go docs).

In our cloudpubsub library, we unmarshal the incoming HTTP data into a protobuf PubsubMessage as a reasonable typed message for the library users. Given this type, it would be nice to have a public function that can extract trace information from such a message.

I have a draft implementation on how that could look like here: #10827
with a corresponding change to our usage in cloudrunner-go here: cloudrunner-go#700
I have tested this locally with the pubsub emulator and the trace information are propagated nicely between publisher and subscribers.

Describe alternatives you've considered

As the solution above is implemented given our already existing handlers and types, I'm open for discussing a better approach which we can later adapt to inside cloudrunner-go 🙂

If it is possible for us to create a pubsub.Message in our HTTP handler, that would make it easier to just export the newMessageCarrier function.

A bigger alternative would be to have HTTP push subscription handlers in the cloud.google.com/go/pubsub package, which could do similar to what we're doing in our cloudpubsub library, but with trace extraction etc managed as well.

Additional context

@radhus radhus added the triage me I really want to be triaged. label Sep 5, 2024
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Sep 5, 2024
@hongalex
Copy link
Member

hongalex commented Sep 6, 2024

Thanks for the issue and the corresponding PR! This will be part of the next release

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. triage me I really want to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants