From ad7702b63dc2d185b9b06e85fee44b571a2e0ae2 Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Tue, 15 Dec 2020 03:47:53 +0000 Subject: [PATCH] feat(spanner): include User agent --- spanner/client.go | 1 + spanner/doc.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/spanner/client.go b/spanner/client.go index eb5ff9798d3..6785c2a09a8 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"