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

Unable to specify spanner.ClientConfig.SessionLabels #278

Open
egonelbre opened this issue Jul 17, 2024 · 0 comments
Open

Unable to specify spanner.ClientConfig.SessionLabels #278

egonelbre opened this issue Jul 17, 2024 · 0 comments
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@egonelbre
Copy link
Contributor

SessionLabels are used to distinguish different systems connecting to spanner and to help diagnosing problems. Currently there's no way to set session labels for connections created by go-sql-spanner. It would be helpful to specify these values.

https://pkg.go.dev/cloud.google.com/go/spanner#ClientConfig.SessionLabels

I can see two approaches here:

A. Add a new options to DSN in

connectorConfig, err := extractConnectorConfig(dsn)
, which would allow to set the config.SessionLabels.

B. Create something like func NewConnector(..., config spanner.ClientConfig) (Connector, error), which could be used in combination with https://pkg.go.dev/database/sql#OpenDB. (This also avoids some of the issues with regards to using global registry for registering connectors).

The A. approach has the benefit of not needing a new API function and can nicely hook into the existing system. However, since it's a "map[string]string" encoding the arguments in a DSN can be unwieldy.

The B. approach has the benefit of exposing everything on spanner.ClientConfig, making it possible to set everything and also doesn't need changing when new features are added to spanner.ClientConfig. Although, it will require designing new API, with multiple additional options for the client ([]option.ClientOption).

@egonelbre egonelbre added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

1 participant