google-cloud-trace 0.37.0 → 0.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 384b1cafe16ad5de310f82ade0a2fe59941cb76ca5cd9a23dabceb3d59df0d5d
4
- data.tar.gz: 74c9edde35e5de3a9b780a3e352a4713b09b90d84a351686b43d02b24ead6bea
3
+ metadata.gz: 106942d3abc46d75853c4168f8d57f06ed34a0f78df7db1c2b1f77fc817fc5cc
4
+ data.tar.gz: 711ccacaba4cf87d52c5f07f71e52f54b843616a3c3c9a541c5d1617abecf9bb
5
5
  SHA512:
6
- metadata.gz: 01a6f53b2db9df587f396421db83b4861beae464f5fb36cddfbe7b7457750f8e760bfcfdb994a374aa583e253fabc2ebb3806aa75faaa1f47460dbcbc509634e
7
- data.tar.gz: 237e306b7ea598485bfa475740cfd8e956ed62d52e8f16d5aa67b2ffe752c837bd96a3e7bbd6ff40ea8a030b7fd91b21da169ab02e4c2166f5829cbdc7e2cbd2
6
+ metadata.gz: 2da8853639e1043895e4a073817f9a03abbc6b0de019e67efce3ed37cd5afcb0731f78ee517dd4fb938460193ffd1d41977304ac70c3ab9c729cd51d79c6d5a4
7
+ data.tar.gz: 5454f9ac12a5cf2823d74b2168620031bdbe11bca37e99afd340992f7dabda0ab974447a16778b8bee2a965f78ddc6f599b1c869e7453494e9f7feca61265425
@@ -1,5 +1,35 @@
1
1
  # Release History
2
2
 
3
+ ### 0.38.3 / 2020-05-28
4
+
5
+ #### Documentation
6
+
7
+ * Fix a few broken links
8
+
9
+ ### 0.38.2 / 2020-05-19
10
+
11
+ #### Bug Fixes
12
+
13
+ * Adjusted some default timeout and retry settings
14
+
15
+ ### 0.38.1 / 2020-05-08
16
+
17
+ #### Bug Fixes
18
+
19
+ * Add service_address and service_port to v2 factory method
20
+
21
+ ### 0.38.0 / 2020-03-11
22
+
23
+ #### Features
24
+
25
+ * Support separate project setting for quota/billing
26
+
27
+ ### 0.37.1 / 2020-01-23
28
+
29
+ #### Documentation
30
+
31
+ * Update Status documentation
32
+
3
33
  ### 0.37.0 / 2019-12-19
4
34
 
5
35
  #### Features
@@ -24,14 +24,8 @@ improved, *please* create a new issue on GitHub so we can talk about it.
24
24
 
25
25
  - [New issue][gh-ruby]
26
26
 
27
- Or, you can ask questions on the [Google Cloud Platform Slack][slack-ruby]. You
28
- can use the "ruby" channel for general Ruby questions, or use the
29
- "google-cloud-ruby" channel if you have questions about this gem in particular.
30
-
31
27
  [so-ruby]: http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby+trace
32
28
 
33
- [gh-search-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues?q=label%3A%22api%3A+trace%22
34
-
35
- [gh-ruby]: https://github.com/googlecloudplatform/google-cloud-ruby/issues/new
29
+ [gh-search-ruby]: https://github.com/googleapis/google-cloud-ruby/issues?q=label%3A%22api%3A+trace%22
36
30
 
37
- [slack-ruby]: https://gcp-slack.appspot.com/
31
+ [gh-ruby]: https://github.com/googleapis/google-cloud-ruby/issues/new
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -151,6 +151,9 @@ module Google
151
151
  google_api_client.freeze
152
152
 
153
153
  headers = { :"x-goog-api-client" => google_api_client }
154
+ if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
155
+ headers[:"x-goog-user-project"] = credentials.quota_project_id
156
+ end
154
157
  headers.merge!(metadata) unless metadata.nil?
155
158
  client_config_file = Pathname.new(__dir__).join(
156
159
  "trace_service_client_config.json"
@@ -183,6 +186,14 @@ module Google
183
186
  &Google::Devtools::Cloudtrace::V1::TraceService::Stub.method(:new)
184
187
  )
185
188
 
189
+ @patch_traces = Google::Gax.create_api_call(
190
+ @trace_service_stub.method(:patch_traces),
191
+ defaults["patch_traces"],
192
+ exception_transformer: exception_transformer,
193
+ params_extractor: proc do |request|
194
+ {'project_id' => request.project_id}
195
+ end
196
+ )
186
197
  @list_traces = Google::Gax.create_api_call(
187
198
  @trace_service_stub.method(:list_traces),
188
199
  defaults["list_traces"],
@@ -196,18 +207,55 @@ module Google
196
207
  defaults["get_trace"],
197
208
  exception_transformer: exception_transformer
198
209
  )
199
- @patch_traces = Google::Gax.create_api_call(
200
- @trace_service_stub.method(:patch_traces),
201
- defaults["patch_traces"],
202
- exception_transformer: exception_transformer,
203
- params_extractor: proc do |request|
204
- {'project_id' => request.project_id}
205
- end
206
- )
207
210
  end
208
211
 
209
212
  # Service calls
210
213
 
214
+ # Sends new traces to Stackdriver Trace or updates existing traces. If the ID
215
+ # of a trace that you send matches that of an existing trace, any fields
216
+ # in the existing trace and its spans are overwritten by the provided values,
217
+ # and any new fields provided are merged with the existing trace data. If the
218
+ # ID does not match, a new trace is created.
219
+ #
220
+ # @param project_id [String]
221
+ # Required. ID of the Cloud project where the trace data is stored.
222
+ # @param traces [Google::Devtools::Cloudtrace::V1::Traces | Hash]
223
+ # Required. The body of the message.
224
+ # A hash of the same form as `Google::Devtools::Cloudtrace::V1::Traces`
225
+ # can also be provided.
226
+ # @param options [Google::Gax::CallOptions]
227
+ # Overrides the default settings for this call, e.g, timeout,
228
+ # retries, etc.
229
+ # @yield [result, operation] Access the result along with the RPC operation
230
+ # @yieldparam result []
231
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
232
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
233
+ # @example
234
+ # require "google/cloud/trace"
235
+ #
236
+ # trace_client = Google::Cloud::Trace.new(version: :v1)
237
+ #
238
+ # # TODO: Initialize `project_id`:
239
+ # project_id = ''
240
+ #
241
+ # # TODO: Initialize `traces`:
242
+ # traces = {}
243
+ # trace_client.patch_traces(project_id, traces)
244
+
245
+ def patch_traces \
246
+ project_id,
247
+ traces,
248
+ options: nil,
249
+ &block
250
+ req = {
251
+ project_id: project_id,
252
+ traces: traces
253
+ }.delete_if { |_, v| v.nil? }
254
+ req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::PatchTracesRequest)
255
+ @patch_traces.call(req, options, &block)
256
+ nil
257
+ end
258
+
211
259
  # Returns of a list of traces that match the specified filter conditions.
212
260
  #
213
261
  # @param project_id [String]
@@ -370,51 +418,6 @@ module Google
370
418
  req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::GetTraceRequest)
371
419
  @get_trace.call(req, options, &block)
372
420
  end
373
-
374
- # Sends new traces to Stackdriver Trace or updates existing traces. If the ID
375
- # of a trace that you send matches that of an existing trace, any fields
376
- # in the existing trace and its spans are overwritten by the provided values,
377
- # and any new fields provided are merged with the existing trace data. If the
378
- # ID does not match, a new trace is created.
379
- #
380
- # @param project_id [String]
381
- # Required. ID of the Cloud project where the trace data is stored.
382
- # @param traces [Google::Devtools::Cloudtrace::V1::Traces | Hash]
383
- # Required. The body of the message.
384
- # A hash of the same form as `Google::Devtools::Cloudtrace::V1::Traces`
385
- # can also be provided.
386
- # @param options [Google::Gax::CallOptions]
387
- # Overrides the default settings for this call, e.g, timeout,
388
- # retries, etc.
389
- # @yield [result, operation] Access the result along with the RPC operation
390
- # @yieldparam result []
391
- # @yieldparam operation [GRPC::ActiveCall::Operation]
392
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
393
- # @example
394
- # require "google/cloud/trace"
395
- #
396
- # trace_client = Google::Cloud::Trace.new(version: :v1)
397
- #
398
- # # TODO: Initialize `project_id`:
399
- # project_id = ''
400
- #
401
- # # TODO: Initialize `traces`:
402
- # traces = {}
403
- # trace_client.patch_traces(project_id, traces)
404
-
405
- def patch_traces \
406
- project_id,
407
- traces,
408
- options: nil,
409
- &block
410
- req = {
411
- project_id: project_id,
412
- traces: traces
413
- }.delete_if { |_, v| v.nil? }
414
- req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V1::PatchTracesRequest)
415
- @patch_traces.call(req, options, &block)
416
- nil
417
- end
418
421
  end
419
422
  end
420
423
  end
@@ -11,28 +11,28 @@
11
11
  "retry_params": {
12
12
  "default": {
13
13
  "initial_retry_delay_millis": 100,
14
- "retry_delay_multiplier": 1.3,
15
- "max_retry_delay_millis": 60000,
14
+ "retry_delay_multiplier": 1.2,
15
+ "max_retry_delay_millis": 1000,
16
16
  "initial_rpc_timeout_millis": 20000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 20000,
19
- "total_timeout_millis": 600000
17
+ "rpc_timeout_multiplier": 1.5,
18
+ "max_rpc_timeout_millis": 30000,
19
+ "total_timeout_millis": 45000
20
20
  }
21
21
  },
22
22
  "methods": {
23
- "ListTraces": {
23
+ "PatchTraces": {
24
24
  "timeout_millis": 60000,
25
25
  "retry_codes_name": "idempotent",
26
26
  "retry_params_name": "default"
27
27
  },
28
- "GetTrace": {
28
+ "ListTraces": {
29
29
  "timeout_millis": 60000,
30
30
  "retry_codes_name": "idempotent",
31
31
  "retry_params_name": "default"
32
32
  },
33
- "PatchTraces": {
33
+ "GetTrace": {
34
34
  "timeout_millis": 60000,
35
- "retry_codes_name": "non_idempotent",
35
+ "retry_codes_name": "idempotent",
36
36
  "retry_params_name": "default"
37
37
  }
38
38
  }
@@ -20,7 +20,7 @@ module Google
20
20
  # rubocop:disable LineLength
21
21
 
22
22
  ##
23
- # # Ruby Client for Stackdriver Trace API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
23
+ # # Ruby Client for Stackdriver Trace API
24
24
  #
25
25
  # [Stackdriver Trace API][Product Documentation]:
26
26
  # Sends application trace data to Stackdriver Trace for viewing. Trace data is
@@ -92,13 +92,19 @@ module Google
92
92
  # or the specified config is missing data points.
93
93
  # @param timeout [Numeric]
94
94
  # The default timeout, in seconds, for calls made through this client.
95
+ # @param service_address [String]
96
+ # Override for the service hostname, or `nil` to leave as the default.
97
+ # @param service_port [Integer]
98
+ # Override for the service port, or `nil` to leave as the default.
95
99
  def self.new \
96
100
  credentials: nil,
97
101
  scopes: nil,
98
102
  client_config: nil,
99
103
  timeout: nil,
100
104
  lib_name: nil,
101
- lib_version: nil
105
+ lib_version: nil,
106
+ service_address: nil,
107
+ service_port: nil
102
108
  kwargs = {
103
109
  credentials: credentials,
104
110
  scopes: scopes,
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -17,67 +17,19 @@ module Google
17
17
  module Rpc
18
18
  # The `Status` type defines a logical error model that is suitable for
19
19
  # different programming environments, including REST APIs and RPC APIs. It is
20
- # used by [gRPC](https://github.com/grpc). The error model is designed to be:
20
+ # used by [gRPC](https://github.com/grpc). Each `Status` message contains
21
+ # three pieces of data: error code, error message, and error details.
21
22
  #
22
- # * Simple to use and understand for most users
23
- # * Flexible enough to meet unexpected needs
24
- #
25
- # = Overview
26
- #
27
- # The `Status` message contains three pieces of data: error code, error
28
- # message, and error details. The error code should be an enum value of
29
- # {Google::Rpc::Code}, but it may accept additional error codes
30
- # if needed. The error message should be a developer-facing English message
31
- # that helps developers *understand* and *resolve* the error. If a localized
32
- # user-facing error message is needed, put the localized message in the error
33
- # details or localize it in the client. The optional error details may contain
34
- # arbitrary information about the error. There is a predefined set of error
35
- # detail types in the package `google.rpc` that can be used for common error
36
- # conditions.
37
- #
38
- # = Language mapping
39
- #
40
- # The `Status` message is the logical representation of the error model, but it
41
- # is not necessarily the actual wire format. When the `Status` message is
42
- # exposed in different client libraries and different wire protocols, it can be
43
- # mapped differently. For example, it will likely be mapped to some exceptions
44
- # in Java, but more likely mapped to some error codes in C.
45
- #
46
- # = Other uses
47
- #
48
- # The error model and the `Status` message can be used in a variety of
49
- # environments, either with or without APIs, to provide a
50
- # consistent developer experience across different environments.
51
- #
52
- # Example uses of this error model include:
53
- #
54
- # * Partial errors. If a service needs to return partial errors to the client,
55
- # it may embed the `Status` in the normal response to indicate the partial
56
- # errors.
57
- #
58
- # * Workflow errors. A typical workflow has multiple steps. Each step may
59
- # have a `Status` message for error reporting.
60
- #
61
- # * Batch operations. If a client uses batch request and batch response, the
62
- # `Status` message should be used directly inside batch response, one for
63
- # each error sub-response.
64
- #
65
- # * Asynchronous operations. If an API call embeds asynchronous operation
66
- # results in its response, the status of those operations should be
67
- # represented directly using the `Status` message.
68
- #
69
- # * Logging. If some API errors are stored in logs, the message `Status` could
70
- # be used directly after any stripping needed for security/privacy reasons.
23
+ # You can find out more about this error model and how to work with it in the
24
+ # [API Design Guide](https://cloud.google.com/apis/design/errors).
71
25
  # @!attribute [rw] code
72
26
  # @return [Integer]
73
- # The status code, which should be an enum value of
74
- # {Google::Rpc::Code}.
27
+ # The status code, which should be an enum value of {Google::Rpc::Code}.
75
28
  # @!attribute [rw] message
76
29
  # @return [String]
77
30
  # A developer-facing error message, which should be in English. Any
78
31
  # user-facing error message should be localized and sent in the
79
- # {Google::Rpc::Status#details} field, or localized
80
- # by the client.
32
+ # {Google::Rpc::Status#details} field, or localized by the client.
81
33
  # @!attribute [rw] details
82
34
  # @return [Array<Google::Protobuf::Any>]
83
35
  # A list of messages that carry the error details. There is a common set of
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -70,6 +70,12 @@ module Google
70
70
 
71
71
  private_constant :PROJECT_PATH_TEMPLATE
72
72
 
73
+ SPAN_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
74
+ "projects/{project}/traces/{trace}/spans/{span}"
75
+ )
76
+
77
+ private_constant :SPAN_PATH_TEMPLATE
78
+
73
79
  # Returns a fully-qualified project resource name string.
74
80
  # @param project [String]
75
81
  # @return [String]
@@ -79,6 +85,19 @@ module Google
79
85
  )
80
86
  end
81
87
 
88
+ # Returns a fully-qualified span resource name string.
89
+ # @param project [String]
90
+ # @param trace [String]
91
+ # @param span [String]
92
+ # @return [String]
93
+ def self.span_path project, trace, span
94
+ SPAN_PATH_TEMPLATE.render(
95
+ :"project" => project,
96
+ :"trace" => trace,
97
+ :"span" => span
98
+ )
99
+ end
100
+
82
101
  # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
83
102
  # Provides the means for authenticating requests made by the client. This parameter can
84
103
  # be many types.
@@ -156,6 +175,9 @@ module Google
156
175
  google_api_client.freeze
157
176
 
158
177
  headers = { :"x-goog-api-client" => google_api_client }
178
+ if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
179
+ headers[:"x-goog-user-project"] = credentials.quota_project_id
180
+ end
159
181
  headers.merge!(metadata) unless metadata.nil?
160
182
  client_config_file = Pathname.new(__dir__).join(
161
183
  "trace_service_client_config.json"
@@ -187,17 +209,17 @@ module Google
187
209
  &Google::Devtools::Cloudtrace::V2::TraceService::Stub.method(:new)
188
210
  )
189
211
 
190
- @batch_write_spans = Google::Gax.create_api_call(
191
- @trace_service_stub.method(:batch_write_spans),
192
- defaults["batch_write_spans"],
212
+ @create_span = Google::Gax.create_api_call(
213
+ @trace_service_stub.method(:create_span),
214
+ defaults["create_span"],
193
215
  exception_transformer: exception_transformer,
194
216
  params_extractor: proc do |request|
195
217
  {'name' => request.name}
196
218
  end
197
219
  )
198
- @create_span = Google::Gax.create_api_call(
199
- @trace_service_stub.method(:create_span),
200
- defaults["create_span"],
220
+ @batch_write_spans = Google::Gax.create_api_call(
221
+ @trace_service_stub.method(:batch_write_spans),
222
+ defaults["batch_write_spans"],
201
223
  exception_transformer: exception_transformer,
202
224
  params_extractor: proc do |request|
203
225
  {'name' => request.name}
@@ -207,48 +229,6 @@ module Google
207
229
 
208
230
  # Service calls
209
231
 
210
- # Sends new spans to new or existing traces. You cannot update
211
- # existing spans.
212
- #
213
- # @param name [String]
214
- # Required. The name of the project where the spans belong. The format is
215
- # `projects/[PROJECT_ID]`.
216
- # @param spans [Array<Google::Devtools::Cloudtrace::V2::Span | Hash>]
217
- # Required. A list of new spans. The span names must not match existing
218
- # spans, or the results are undefined.
219
- # A hash of the same form as `Google::Devtools::Cloudtrace::V2::Span`
220
- # can also be provided.
221
- # @param options [Google::Gax::CallOptions]
222
- # Overrides the default settings for this call, e.g, timeout,
223
- # retries, etc.
224
- # @yield [result, operation] Access the result along with the RPC operation
225
- # @yieldparam result []
226
- # @yieldparam operation [GRPC::ActiveCall::Operation]
227
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
228
- # @example
229
- # require "google/cloud/trace"
230
- #
231
- # trace_client = Google::Cloud::Trace.new(version: :v2)
232
- # formatted_name = Google::Cloud::Trace::V2::TraceServiceClient.project_path("[PROJECT]")
233
- #
234
- # # TODO: Initialize `spans`:
235
- # spans = []
236
- # trace_client.batch_write_spans(formatted_name, spans)
237
-
238
- def batch_write_spans \
239
- name,
240
- spans,
241
- options: nil,
242
- &block
243
- req = {
244
- name: name,
245
- spans: spans
246
- }.delete_if { |_, v| v.nil? }
247
- req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V2::BatchWriteSpansRequest)
248
- @batch_write_spans.call(req, options, &block)
249
- nil
250
- end
251
-
252
232
  # Creates a new span.
253
233
  #
254
234
  # @param name [String]
@@ -334,9 +314,7 @@ module Google
334
314
  # require "google/cloud/trace"
335
315
  #
336
316
  # trace_client = Google::Cloud::Trace.new(version: :v2)
337
- #
338
- # # TODO: Initialize `name`:
339
- # name = ''
317
+ # formatted_name = Google::Cloud::Trace::V2::TraceServiceClient.span_path("[PROJECT]", "[TRACE]", "[SPAN]")
340
318
  #
341
319
  # # TODO: Initialize `span_id`:
342
320
  # span_id = ''
@@ -349,7 +327,7 @@ module Google
349
327
  #
350
328
  # # TODO: Initialize `end_time`:
351
329
  # end_time = {}
352
- # response = trace_client.create_span(name, span_id, display_name, start_time, end_time)
330
+ # response = trace_client.create_span(formatted_name, span_id, display_name, start_time, end_time)
353
331
 
354
332
  def create_span \
355
333
  name,
@@ -385,6 +363,48 @@ module Google
385
363
  req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V2::Span)
386
364
  @create_span.call(req, options, &block)
387
365
  end
366
+
367
+ # Sends new spans to new or existing traces. You cannot update
368
+ # existing spans.
369
+ #
370
+ # @param name [String]
371
+ # Required. The name of the project where the spans belong. The format is
372
+ # `projects/[PROJECT_ID]`.
373
+ # @param spans [Array<Google::Devtools::Cloudtrace::V2::Span | Hash>]
374
+ # Required. A list of new spans. The span names must not match existing
375
+ # spans, or the results are undefined.
376
+ # A hash of the same form as `Google::Devtools::Cloudtrace::V2::Span`
377
+ # can also be provided.
378
+ # @param options [Google::Gax::CallOptions]
379
+ # Overrides the default settings for this call, e.g, timeout,
380
+ # retries, etc.
381
+ # @yield [result, operation] Access the result along with the RPC operation
382
+ # @yieldparam result []
383
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
384
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
385
+ # @example
386
+ # require "google/cloud/trace"
387
+ #
388
+ # trace_client = Google::Cloud::Trace.new(version: :v2)
389
+ # formatted_name = Google::Cloud::Trace::V2::TraceServiceClient.project_path("[PROJECT]")
390
+ #
391
+ # # TODO: Initialize `spans`:
392
+ # spans = []
393
+ # trace_client.batch_write_spans(formatted_name, spans)
394
+
395
+ def batch_write_spans \
396
+ name,
397
+ spans,
398
+ options: nil,
399
+ &block
400
+ req = {
401
+ name: name,
402
+ spans: spans
403
+ }.delete_if { |_, v| v.nil? }
404
+ req = Google::Gax::to_proto(req, Google::Devtools::Cloudtrace::V2::BatchWriteSpansRequest)
405
+ @batch_write_spans.call(req, options, &block)
406
+ nil
407
+ end
388
408
  end
389
409
  end
390
410
  end
@@ -11,21 +11,21 @@
11
11
  "retry_params": {
12
12
  "default": {
13
13
  "initial_retry_delay_millis": 100,
14
- "retry_delay_multiplier": 1.3,
15
- "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 20000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 20000,
19
- "total_timeout_millis": 600000
14
+ "retry_delay_multiplier": 1.2,
15
+ "max_retry_delay_millis": 1000,
16
+ "initial_rpc_timeout_millis": 30000,
17
+ "rpc_timeout_multiplier": 1.5,
18
+ "max_rpc_timeout_millis": 60000,
19
+ "total_timeout_millis": 120000
20
20
  }
21
21
  },
22
22
  "methods": {
23
- "BatchWriteSpans": {
23
+ "CreateSpan": {
24
24
  "timeout_millis": 60000,
25
- "retry_codes_name": "non_idempotent",
25
+ "retry_codes_name": "idempotent",
26
26
  "retry_params_name": "default"
27
27
  },
28
- "CreateSpan": {
28
+ "BatchWriteSpans": {
29
29
  "timeout_millis": 60000,
30
30
  "retry_codes_name": "non_idempotent",
31
31
  "retry_params_name": "default"
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Trace
19
- VERSION = "0.37.0".freeze
19
+ VERSION = "0.38.3".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-trace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.37.0
4
+ version: 0.38.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-20 00:00:00.000000000 Z
11
+ date: 2020-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core