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

proposal: contrib/cloud.google.com/go/pubsub should support custom service names #752

Closed
mickeyreiss opened this issue Oct 3, 2020 · 1 comment · Fixed by #757
Closed
Labels
proposal more in depth change that requires full team approval

Comments

@mickeyreiss
Copy link
Contributor

It is useful to be able to configure span options, such as a default service name, but pubsubtrace.WrapReceiveHandler does not allow this override.

In particular, this signature:

func WrapReceiveHandler(s *pubsub.Subscription, f func(context.Context, *pubsub.Message)) func(context.Context, *pubsub.Message)

doesn't allow one to set the service name.

Maybe it should be something like this:

func WrapReceiveHandler(s *pubsub.Subscription, f func(context.Context, *pubsub.Message), , opts ...ReceiveOption) func(context.Context, *pubsub.Message)

Here's sql trace, for comparison, which does allow overrides via the third parameter on:

func Register(driverName string, driver driver.Driver, opts ...RegisterOption)
@knusbaum knusbaum added the proposal more in depth change that requires full team approval label Oct 5, 2020
@knusbaum knusbaum changed the title contrib/cloud.google.com/go/pubsub should support custom service names proposal: contrib/cloud.google.com/go/pubsub should support custom service names Oct 5, 2020
@knusbaum
Copy link
Contributor

knusbaum commented Oct 5, 2020

Enabling users to specify things like the service name is ideal.

I think 'WrapReceiveHandler` could just take a variadic list of StartSpanOption, and we can add those to a list of the existing options.

We do want to maintain backwards-compatibility, so we should give this function a new name, and have WrapReceiveHandler call the new function with no additional arguments.
Scratch that. A variadic function shouldn't require a rename since zero option arguments is valid. 😄

knusbaum pushed a commit that referenced this issue Dec 1, 2020
This adds a new options parameter, as well as a new option for
WrapReceiveHandler, so that GCP pubsub receivers can set a custom service
name for their traces.

This PR also introduces an options pattern for this library, so that other
options can be added in the future.

Fixes #752
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal more in depth change that requires full team approval
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants