Unable to specify spanner.ClientConfig.SessionLabels #278
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.
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
go-sql-spanner/driver.go
Line 187 in 94bc417
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
).The text was updated successfully, but these errors were encountered: