From 4e1ef1b3fb536ef950249cdee02cc0b6c2b56e86 Mon Sep 17 00:00:00 2001 From: Mohan Li <67390330+mohanli-ml@users.noreply.github.com> Date: Tue, 22 Dec 2020 15:14:56 -0800 Subject: [PATCH] feat(spanner): include User agent (#3465) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Knut Olav Løite --- spanner/client.go | 1 + spanner/doc.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/spanner/client.go b/spanner/client.go index 8f14968e04b..1a52fa5abfd 100644 --- a/spanner/client.go +++ b/spanner/client.go @@ -177,6 +177,7 @@ func NewClientWithConfig(ctx context.Context, database string, config ClientConf ), ), option.WithGRPCConnectionPool(config.NumChannels), + option.WithUserAgent(clientUserAgent), } // opts will take precedence above allOpts, as the values in opts will be // applied after the values in allOpts. diff --git a/spanner/doc.go b/spanner/doc.go index eecaad06526..86e44b2c395 100644 --- a/spanner/doc.go +++ b/spanner/doc.go @@ -357,3 +357,8 @@ at https://godoc.org/go.opencensus.io/trace. OpenCensus tracing requires Go 1.8 or higher. */ package spanner // import "cloud.google.com/go/spanner" + +// clientUserAgent identifies the version of this package. +// It should be the same as https://pkg.go.dev/cloud.google.com/go/spanner. +// TODO: We will want to automate the version with a bash script. +const clientUserAgent = "spanner-go/v1.12.0"