Skip to content

Commit

Permalink
chore: bulk update version for manual
Browse files Browse the repository at this point in the history
This changes bulk updates all manuals that has reference to the
old version.Repo that has been a long incorrect value. This new
version files will be maintained by release please.

Updates: googleapis#2749

feat(bigquery): add better version metadata to calls

feat(datastore): add better version metadata to calls

feat(errorreporting): add better version metadata to calls

feat(firestore): add better version metadata to calls

feat(logging): add better version metadata to calls

feat(profiler): add better version metadata to calls

feat(pubsub): add better version metadata to calls

feat(translate): add better version metadata to calls
  • Loading branch information
codyoss committed Feb 11, 2022
1 parent 498a746 commit f8d6f87
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 21 deletions.
5 changes: 3 additions & 2 deletions bigquery/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"strings"
"time"

"cloud.google.com/go/bigquery/internal"
"cloud.google.com/go/internal"
"cloud.google.com/go/internal/detect"
"cloud.google.com/go/internal/version"
Expand All @@ -40,7 +41,7 @@ const (
userAgentPrefix = "gcloud-golang-bigquery"
)

var xGoogHeader = fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), version.Repo)
var xGoogHeader = fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), internal.Version)

func setClientHeader(headers http.Header) {
headers.Set("x-goog-api-client", xGoogHeader)
Expand Down Expand Up @@ -74,7 +75,7 @@ const DetectProjectID = "*detect-project-id*"
func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) {
o := []option.ClientOption{
option.WithScopes(Scope),
option.WithUserAgent(fmt.Sprintf("%s/%s", userAgentPrefix, version.Repo)),
option.WithUserAgent(fmt.Sprintf("%s/%s", userAgentPrefix, internal.Version)),
}
o = append(o, opts...)
bqs, err := bq.NewService(ctx, o...)
Expand Down
18 changes: 18 additions & 0 deletions bigquery/internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

// Version is the current tagged release of the library.
const Version = "1.27.0"
7 changes: 4 additions & 3 deletions datastore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import (
"fmt"
"time"

"cloud.google.com/go/internal"
"cloud.google.com/go/datastore/internal"
cloudinternal "cloud.google.com/go/internal"
"cloud.google.com/go/internal/trace"
"cloud.google.com/go/internal/version"
gax "github.com/googleapis/gax-go/v2"
Expand All @@ -46,7 +47,7 @@ func newDatastoreClient(conn grpc.ClientConnInterface, projectID string) pb.Data
c: pb.NewDatastoreClient(conn),
md: metadata.Pairs(
resourcePrefixHeader, "projects/"+projectID,
"x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s grpc/", version.Go(), version.Repo)),
"x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s grpc/", version.Go(), internal.Version)),
}
}

Expand Down Expand Up @@ -118,7 +119,7 @@ func (dc *datastoreClient) AllocateIds(ctx context.Context, in *pb.AllocateIdsRe

func (dc *datastoreClient) invoke(ctx context.Context, f func(ctx context.Context) error) error {
ctx = metadata.NewOutgoingContext(ctx, dc.md)
return internal.Retry(ctx, gax.Backoff{Initial: 100 * time.Millisecond}, func() (stop bool, err error) {
return cloudinternal.Retry(ctx, gax.Backoff{Initial: 100 * time.Millisecond}, func() (stop bool, err error) {
err = f(ctx)
return !shouldRetry(err), err
})
Expand Down
18 changes: 18 additions & 0 deletions datastore/internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

// Version is the current tagged release of the library.
const Version = "1.6.0"
4 changes: 2 additions & 2 deletions errorreporting/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"time"

vkit "cloud.google.com/go/errorreporting/apiv1beta1"
"cloud.google.com/go/internal/version"
"cloud.google.com/go/errorreporting/internal"
"github.com/golang/protobuf/ptypes"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
Expand Down Expand Up @@ -88,7 +88,7 @@ var newClient = func(ctx context.Context, opts ...option.ClientOption) (client,
if err != nil {
return nil, err
}
client.SetGoogleClientInfo("gccl", version.Repo)
client.SetGoogleClientInfo("gccl", internal.Version)
return client, nil
}

Expand Down
18 changes: 18 additions & 0 deletions errorreporting/internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

// Version is the current tagged release of the library.
const Version = "0.1.0"
4 changes: 2 additions & 2 deletions firestore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"time"

vkit "cloud.google.com/go/firestore/apiv1"
"cloud.google.com/go/firestore/internal"
"cloud.google.com/go/internal/trace"
"cloud.google.com/go/internal/version"
"github.com/golang/protobuf/ptypes"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
Expand Down Expand Up @@ -92,7 +92,7 @@ func NewClient(ctx context.Context, projectID string, opts ...option.ClientOptio
if err != nil {
return nil, err
}
vc.SetGoogleClientInfo("gccl", version.Repo)
vc.SetGoogleClientInfo("gccl", internal.Version)
c := &Client{
c: vc,
projectID: projectID,
Expand Down
18 changes: 18 additions & 0 deletions firestore/internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

// Version is the current tagged release of the library.
const Version = "1.6.1"
18 changes: 18 additions & 0 deletions logging/internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

// Version is the current tagged release of the library.
const Version = "1.4.2"
7 changes: 3 additions & 4 deletions logging/logadmin/logadmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"strings"
"time"

"cloud.google.com/go/internal/version"
"cloud.google.com/go/logging"
vkit "cloud.google.com/go/logging/apiv2"
"cloud.google.com/go/logging/internal"
Expand Down Expand Up @@ -95,9 +94,9 @@ func NewClient(ctx context.Context, parent string, opts ...option.ClientOption)
mc.CallOptions.CreateLogMetric = []gax.CallOption{gax.WithRetry(retryerOnInternal)}
mc.CallOptions.UpdateLogMetric = []gax.CallOption{gax.WithRetry(retryerOnInternal)}

lc.SetGoogleClientInfo("gccl", version.Repo)
sc.SetGoogleClientInfo("gccl", version.Repo)
mc.SetGoogleClientInfo("gccl", version.Repo)
lc.SetGoogleClientInfo("gccl", internal.Version)
sc.SetGoogleClientInfo("gccl", internal.Version)
mc.SetGoogleClientInfo("gccl", internal.Version)
client := &Client{
lClient: lc,
sClient: sc,
Expand Down
3 changes: 1 addition & 2 deletions logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
"time"
"unicode/utf8"

"cloud.google.com/go/internal/version"
vkit "cloud.google.com/go/logging/apiv2"
"cloud.google.com/go/logging/internal"
"github.com/golang/protobuf/proto"
Expand Down Expand Up @@ -143,7 +142,7 @@ func NewClient(ctx context.Context, parent string, opts ...option.ClientOption)
if err != nil {
return nil, err
}
c.SetGoogleClientInfo("gccl", version.Repo)
c.SetGoogleClientInfo("gccl", internal.Version)
client := &Client{
client: c,
parent: parent,
Expand Down
18 changes: 18 additions & 0 deletions profiler/internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

// Version is the current tagged release of the library.
const Version = "0.1.2"
7 changes: 4 additions & 3 deletions profiler/profiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (

gcemd "cloud.google.com/go/compute/metadata"
"cloud.google.com/go/internal/version"
"cloud.google.com/go/profiler/internal"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/google/pprof/profile"
Expand Down Expand Up @@ -240,7 +241,7 @@ func start(cfg Config, options ...option.ClientOption) error {
opts := []option.ClientOption{
option.WithEndpoint(config.APIAddr),
option.WithScopes(scope),
option.WithUserAgent(fmt.Sprintf("gcloud-go-profiler/%s", version.Repo)),
option.WithUserAgent(fmt.Sprintf("gcloud-go-profiler/%s", internal.Version)),
}
if !config.EnableOCTelemetry {
opts = append(opts, option.WithTelemetryDisabled())
Expand Down Expand Up @@ -475,7 +476,7 @@ func mutexProfile() (*profile.Profile, error) {
// the `x-goog-api-client` header passed on each request. Intended for
// use by Google-written clients.
func withXGoogHeader(ctx context.Context, keyval ...string) context.Context {
kv := append([]string{"gl-go", version.Go(), "gccl", version.Repo}, keyval...)
kv := append([]string{"gl-go", version.Go(), "gccl", internal.Version}, keyval...)
kv = append(kv, "gax", gax.Version, "grpc", grpc.Version)

md, _ := grpcmd.FromOutgoingContext(ctx)
Expand Down Expand Up @@ -610,7 +611,7 @@ func initializeConfig(cfg Config) error {
// server for instructions, and collects and uploads profiles as
// requested.
func pollProfilerService(ctx context.Context, a *agent) {
debugLog("Cloud Profiler Go Agent version: %s", version.Repo)
debugLog("Cloud Profiler Go Agent version: %s", internal.Version)
debugLog("profiler has started")
for i := 0; config.numProfiles == 0 || i < config.numProfiles; i++ {
p := a.createProfile(ctx)
Expand Down
18 changes: 18 additions & 0 deletions pubsub/internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

// Version is the current tagged release of the library.
const Version = "1.18.0"
4 changes: 2 additions & 2 deletions pubsub/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"strings"
"time"

"cloud.google.com/go/internal/version"
vkit "cloud.google.com/go/pubsub/apiv1"
"cloud.google.com/go/pubsub/internal"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
"google.golang.org/grpc"
Expand Down Expand Up @@ -158,7 +158,7 @@ func NewClientWithConfig(ctx context.Context, projectID string, config *ClientCo
pubc.CallOptions = mergePublisherCallOptions(pubc.CallOptions, config.PublisherCallOptions)
subc.CallOptions = mergeSubscriberCallOptions(subc.CallOptions, config.SubscriberCallOptions)
}
pubc.SetGoogleClientInfo("gccl", version.Repo)
pubc.SetGoogleClientInfo("gccl", internal.Version)
return &Client{
projectID: projectID,
pubc: pubc,
Expand Down
18 changes: 18 additions & 0 deletions translate/internal/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package internal

// Version is the current tagged release of the library.
const Version = "1.0.0"
3 changes: 2 additions & 1 deletion translate/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"net/http"

"cloud.google.com/go/internal/version"
"cloud.google.com/go/translate/internal"
"golang.org/x/text/language"
"google.golang.org/api/option"
raw "google.golang.org/api/translate/v2"
Expand Down Expand Up @@ -236,5 +237,5 @@ type Language struct {
}

func setClientHeader(headers http.Header) {
headers.Set("x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), version.Repo))
headers.Set("x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), internal.Version))
}

0 comments on commit f8d6f87

Please sign in to comment.