diff --git a/go.mod b/go.mod index f4729e824d1bc..c3bb6eb8fa034 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.23.1 require ( cloud.google.com/go/bigtable v1.33.0 - cloud.google.com/go/pubsub v1.45.1 + cloud.google.com/go/pubsub v1.45.2 cloud.google.com/go/storage v1.47.0 dario.cat/mergo v1.0.1 github.com/Azure/azure-pipeline-go v0.2.3 diff --git a/go.sum b/go.sum index caecf10edf400..f804a1ce363d1 100644 --- a/go.sum +++ b/go.sum @@ -536,8 +536,8 @@ cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhz cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8= cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= cloud.google.com/go/pubsub v1.32.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/pubsub v1.45.1 h1:ZC/UzYcrmK12THWn1P72z+Pnp2vu/zCZRXyhAfP1hJY= -cloud.google.com/go/pubsub v1.45.1/go.mod h1:3bn7fTmzZFwaUjllitv1WlsNMkqBgGUb3UdMhI54eCc= +cloud.google.com/go/pubsub v1.45.2 h1:TLsGaQDFg92yLCm993tS0md22eku0weBWlLhInxizgs= +cloud.google.com/go/pubsub v1.45.2/go.mod h1:3bn7fTmzZFwaUjllitv1WlsNMkqBgGUb3UdMhI54eCc= cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg= cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k= cloud.google.com/go/pubsublite v1.7.0/go.mod h1:8hVMwRXfDfvGm3fahVbtDbiLePT3gpoiJYJY+vxWxVM= diff --git a/vendor/cloud.google.com/go/pubsub/CHANGES.md b/vendor/cloud.google.com/go/pubsub/CHANGES.md index 11038ccad2f58..d4c79a08cc28a 100644 --- a/vendor/cloud.google.com/go/pubsub/CHANGES.md +++ b/vendor/cloud.google.com/go/pubsub/CHANGES.md @@ -1,5 +1,19 @@ # Changes +## [1.45.2](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.45.1...pubsub/v1.45.2) (2024-12-03) + + +### Bug Fixes + +* **pubsub/pstest:** Make invalid filter return error instead of panic ([#11087](https://github.com/googleapis/google-cloud-go/issues/11087)) ([45e1ce7](https://github.com/googleapis/google-cloud-go/commit/45e1ce70e2757b78b868768b93e05da8858bab85)) +* **pubsub:** Only init batch span if trace enabled ([#11193](https://github.com/googleapis/google-cloud-go/issues/11193)) ([f843d50](https://github.com/googleapis/google-cloud-go/commit/f843d50f849c5014eba33d923085f0add41365a6)) +* **pubsub:** Use official semconv variable whenever possible ([#10904](https://github.com/googleapis/google-cloud-go/issues/10904)) ([1ce4b6d](https://github.com/googleapis/google-cloud-go/commit/1ce4b6dc31653ca6f28c50d5149d74b827caaeaa)) + + +### Documentation + +* **pubsub:** MinExtensionPeriod defaults to 60 seconds ([#10791](https://github.com/googleapis/google-cloud-go/issues/10791)) ([cc88fe1](https://github.com/googleapis/google-cloud-go/commit/cc88fe1c8d834903e2b5f8d3a7cc9bbd65c70b29)) + ## [1.45.1](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.45.0...pubsub/v1.45.1) (2024-10-24) diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/auxiliary.go b/vendor/cloud.google.com/go/pubsub/apiv1/auxiliary.go index 3a9bcffd52543..46380a0e05dac 100644 --- a/vendor/cloud.google.com/go/pubsub/apiv1/auxiliary.go +++ b/vendor/cloud.google.com/go/pubsub/apiv1/auxiliary.go @@ -41,7 +41,7 @@ type SchemaIterator struct { InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Schema, nextPageToken string, err error) } -// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *SchemaIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } @@ -88,7 +88,7 @@ type SnapshotIterator struct { InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Snapshot, nextPageToken string, err error) } -// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *SnapshotIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } @@ -135,7 +135,7 @@ type StringIterator struct { InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error) } -// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *StringIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } @@ -182,7 +182,7 @@ type SubscriptionIterator struct { InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Subscription, nextPageToken string, err error) } -// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *SubscriptionIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } @@ -229,7 +229,7 @@ type TopicIterator struct { InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Topic, nextPageToken string, err error) } -// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. func (it *TopicIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/doc.go b/vendor/cloud.google.com/go/pubsub/apiv1/doc.go index 650d23343fb9f..03aeef34e3910 100644 --- a/vendor/cloud.google.com/go/pubsub/apiv1/doc.go +++ b/vendor/cloud.google.com/go/pubsub/apiv1/doc.go @@ -36,6 +36,7 @@ // // To get started with this package, create a client. // +// // go get cloud.google.com/go/pubsub/apiv1@latest // ctx := context.Background() // // This snippet has been automatically generated and should be regarded as a code template only. // // It will require modifications to work: @@ -54,19 +55,7 @@ // // # Using the Client // -// The following is an example of making an API call with the newly created client. -// -// ctx := context.Background() -// // This snippet has been automatically generated and should be regarded as a code template only. -// // It will require modifications to work: -// // - It may require correct/in-range values for request initialization. -// // - It may require specifying regional endpoints when creating the service client as shown in: -// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options -// c, err := pubsub.NewSchemaClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// The following is an example of making an API call with the newly created client, mentioned above. // // req := &pubsubpb.CommitSchemaRequest{ // // TODO: Fill request struct fields. @@ -93,31 +82,3 @@ // [Debugging Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Debugging // [Inspecting errors]: https://pkg.go.dev/cloud.google.com/go#hdr-Inspecting_errors package pubsub // import "cloud.google.com/go/pubsub/apiv1" - -import ( - "context" - - "google.golang.org/api/option" -) - -// For more information on implementing a client constructor hook, see -// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. -type clientHookParams struct{} -type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) - -var versionClient string - -func getVersionClient() string { - if versionClient == "" { - return "UNKNOWN" - } - return versionClient -} - -// DefaultAuthScopes reports the default set of authentication scopes to use with this package. -func DefaultAuthScopes() []string { - return []string{ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub", - } -} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/helpers.go b/vendor/cloud.google.com/go/pubsub/apiv1/helpers.go new file mode 100644 index 0000000000000..512907422f30a --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/helpers.go @@ -0,0 +1,45 @@ +// Copyright 2024 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 +// +// https://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. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package pubsub + +import ( + "context" + + "google.golang.org/api/option" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +var versionClient string + +func getVersionClient() string { + if versionClient == "" { + return "UNKNOWN" + } + return versionClient +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub", + } +} diff --git a/vendor/cloud.google.com/go/pubsub/internal/version.go b/vendor/cloud.google.com/go/pubsub/internal/version.go index e7729577cf3b9..79d07af8e898d 100644 --- a/vendor/cloud.google.com/go/pubsub/internal/version.go +++ b/vendor/cloud.google.com/go/pubsub/internal/version.go @@ -15,4 +15,4 @@ package internal // Version is the current tagged release of the library. -const Version = "1.45.1" +const Version = "1.45.2" diff --git a/vendor/cloud.google.com/go/pubsub/iterator.go b/vendor/cloud.google.com/go/pubsub/iterator.go index 4f791fa6c06ae..c533f29877d14 100644 --- a/vendor/cloud.google.com/go/pubsub/iterator.go +++ b/vendor/cloud.google.com/go/pubsub/iterator.go @@ -279,7 +279,7 @@ func (it *messageIterator) receive(maxToPull int32) ([]*Message, error) { // If the cancellation comes from the underlying grpc client getting closed, // do propagate the cancellation error. // See https://github.com/googleapis/google-cloud-go/pull/10153#discussion_r1600814775 - if err != nil && it.ps.ctx.Err() == context.Canceled { + if err != nil && errors.Is(it.ps.ctx.Err(), context.Canceled) { err = io.EOF } } @@ -340,7 +340,7 @@ func (it *messageIterator) receive(maxToPull int32) ([]*Message, error) { opts, trace.WithAttributes( attribute.Bool(eosAttribute, it.enableExactlyOnceDelivery), - attribute.String(ackIDAttribute, ackID), + semconv.MessagingGCPPubsubMessageAckID(ackID), semconv.MessagingBatchMessageCount(len(msgs)), semconv.CodeFunction("receive"), ), @@ -406,7 +406,7 @@ func (it *messageIterator) pullMessages(maxToPull int32) ([]*pb.ReceivedMessage, MaxMessages: maxToPull, }, gax.WithGRPCOptions(grpc.MaxCallRecvMsgSize(maxSendRecvBytes))) switch { - case err == context.Canceled: + case errors.Is(err, context.Canceled): return nil, nil case status.Code(err) == codes.Canceled: return nil, nil diff --git a/vendor/cloud.google.com/go/pubsub/subscription.go b/vendor/cloud.google.com/go/pubsub/subscription.go index c6311d6e933bf..ebd522bc013bb 100644 --- a/vendor/cloud.google.com/go/pubsub/subscription.go +++ b/vendor/cloud.google.com/go/pubsub/subscription.go @@ -546,7 +546,7 @@ type SubscriptionConfig struct { // When calling Subscription.Receive(), the client will check this // value with a call to Subscription.Config(), which requires the // roles/viewer or roles/pubsub.viewer role on your service account. - // If that call fails, mesages with ordering keys will be delivered in order. + // If that call fails, messages with ordering keys will be delivered in order. EnableMessageOrdering bool // DeadLetterPolicy specifies the conditions for dead lettering messages in @@ -899,8 +899,7 @@ type ReceiveSettings struct { // // MinExtensionPeriod must be between 10s and 600s (inclusive). This configuration // can be disabled by specifying a duration less than (or equal to) 0. - // Defaults to off but set to 60 seconds if the subscription has exactly-once delivery enabled, - // which will be added in a future release. + // Disabled by default but set to 60 seconds if the subscription has exactly-once delivery enabled. MinExtensionPeriod time.Duration // MaxOutstandingMessages is the maximum number of unprocessed messages @@ -1379,7 +1378,7 @@ func (s *Subscription) Receive(ctx context.Context, f func(context.Context, *Mes } msgs, err := iter.receive(maxToPull) - if err == io.EOF { + if errors.Is(err, io.EOF) { return nil } if err != nil { diff --git a/vendor/cloud.google.com/go/pubsub/topic.go b/vendor/cloud.google.com/go/pubsub/topic.go index bb916f5290565..72d9a34590358 100644 --- a/vendor/cloud.google.com/go/pubsub/topic.go +++ b/vendor/cloud.google.com/go/pubsub/topic.go @@ -993,8 +993,6 @@ func (t *Topic) Publish(ctx context.Context, msg *Message) *PublishResult { fcSpan.End() } - _, batcherSpan = startSpan(ctx, batcherSpanName, "") - bmsg := &bundledMessage{ msg: msg, res: r, @@ -1003,6 +1001,7 @@ func (t *Topic) Publish(ctx context.Context, msg *Message) *PublishResult { } if t.enableTracing { + _, batcherSpan = startSpan(ctx, batcherSpanName, "") bmsg.batcherSpan = batcherSpan // Inject the context from the first publish span rather than from flow control / batching. diff --git a/vendor/cloud.google.com/go/pubsub/trace.go b/vendor/cloud.google.com/go/pubsub/trace.go index 51112bb50f5f3..6ff88a8479343 100644 --- a/vendor/cloud.google.com/go/pubsub/trace.go +++ b/vendor/cloud.google.com/go/pubsub/trace.go @@ -360,14 +360,11 @@ const ( resultExpired = "expired" // custom pubsub specific attributes - gcpProjectIDAttribute = "gcp.project_id" - pubsubPrefix = "messaging.gcp_pubsub." - orderingAttribute = pubsubPrefix + "message.ordering_key" - deliveryAttemptAttribute = pubsubPrefix + "message.delivery_attempt" - eosAttribute = pubsubPrefix + "exactly_once_delivery" - ackIDAttribute = pubsubPrefix + "message.ack_id" - resultAttribute = pubsubPrefix + "result" - receiptModackAttribute = pubsubPrefix + "is_receipt_modack" + gcpProjectIDAttribute = "gcp.project_id" + pubsubPrefix = "messaging.gcp_pubsub." + eosAttribute = pubsubPrefix + "exactly_once_delivery" + resultAttribute = pubsubPrefix + "result" + receiptModackAttribute = pubsubPrefix + "is_receipt_modack" ) func startSpan(ctx context.Context, spanType, resourceID string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { @@ -383,7 +380,7 @@ func getPublishSpanAttributes(project, dst string, msg *Message, attrs ...attrib trace.WithAttributes( semconv.MessagingMessageID(msg.ID), semconv.MessagingMessageBodySize(len(msg.Data)), - attribute.String(orderingAttribute, msg.OrderingKey), + semconv.MessagingGCPPubsubMessageOrderingKey(msg.OrderingKey), ), trace.WithAttributes(attrs...), trace.WithSpanKind(trace.SpanKindProducer), @@ -397,13 +394,13 @@ func getSubscriberOpts(project, dst string, msg *Message, attrs ...attribute.Key trace.WithAttributes( semconv.MessagingMessageID(msg.ID), semconv.MessagingMessageBodySize(len(msg.Data)), - attribute.String(orderingAttribute, msg.OrderingKey), + semconv.MessagingGCPPubsubMessageOrderingKey(msg.OrderingKey), ), trace.WithAttributes(attrs...), trace.WithSpanKind(trace.SpanKindConsumer), } if msg.DeliveryAttempt != nil { - opts = append(opts, trace.WithAttributes(attribute.Int(deliveryAttemptAttribute, *msg.DeliveryAttempt))) + opts = append(opts, trace.WithAttributes(semconv.MessagingGCPPubsubMessageDeliveryAttempt(*msg.DeliveryAttempt))) } opts = append(opts, getCommonOptions(project, dst)...) return opts diff --git a/vendor/modules.txt b/vendor/modules.txt index 6868137a4b0e8..a244470a5972c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -55,7 +55,7 @@ cloud.google.com/go/longrunning/autogen/longrunningpb cloud.google.com/go/monitoring/apiv3/v2 cloud.google.com/go/monitoring/apiv3/v2/monitoringpb cloud.google.com/go/monitoring/internal -# cloud.google.com/go/pubsub v1.45.1 +# cloud.google.com/go/pubsub v1.45.2 ## explicit; go 1.21 cloud.google.com/go/pubsub cloud.google.com/go/pubsub/apiv1