google-cloud-trace-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/trace/v1"
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/trace/v1/trace_service"
20
+ require "google/cloud/trace/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Trace
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/trace/v1"
29
+ # client = ::Google::Cloud::Trace::V1::TraceService::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/trace/v1/version"
24
+
25
+ require "google/cloud/trace/v1/trace_service/credentials"
26
+ require "google/cloud/trace/v1/trace_service/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module Trace
31
+ module V1
32
+ ##
33
+ # This file describes an API for collecting and viewing traces and spans
34
+ # within a trace. A Trace is a collection of spans corresponding to a single
35
+ # operation or set of operations for an application. A span is an individual
36
+ # timed event which forms a node of the trace tree. Spans for a single trace
37
+ # may span multiple services.
38
+ #
39
+ # To load this service and instantiate a client:
40
+ #
41
+ # require "google/cloud/trace/v1/trace_service"
42
+ # client = ::Google::Cloud::Trace::V1::TraceService::Client.new
43
+ #
44
+ module TraceService
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ helper_path = ::File.join __dir__, "trace_service", "helpers.rb"
52
+ require "google/cloud/trace/v1/trace_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,612 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/devtools/cloudtrace/v1/trace_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Trace
25
+ module V1
26
+ module TraceService
27
+ ##
28
+ # Client for the TraceService service.
29
+ #
30
+ # This file describes an API for collecting and viewing traces and spans
31
+ # within a trace. A Trace is a collection of spans corresponding to a single
32
+ # operation or set of operations for an application. A span is an individual
33
+ # timed event which forms a node of the trace tree. Spans for a single trace
34
+ # may span multiple services.
35
+ #
36
+ class Client
37
+ # @private
38
+ attr_reader :trace_service_stub
39
+
40
+ ##
41
+ # Configure the TraceService Client class.
42
+ #
43
+ # See {::Google::Cloud::Trace::V1::TraceService::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # ## Example
47
+ #
48
+ # To modify the configuration for all TraceService clients:
49
+ #
50
+ # ::Google::Cloud::Trace::V1::TraceService::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Trace", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const&.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.rpcs.list_traces.timeout = 45.0
71
+ default_config.rpcs.list_traces.retry_policy = {
72
+ initial_delay: 0.1,
73
+ max_delay: 1.0,
74
+ multiplier: 1.2,
75
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
76
+ }
77
+
78
+ default_config.rpcs.get_trace.timeout = 45.0
79
+ default_config.rpcs.get_trace.retry_policy = {
80
+ initial_delay: 0.1,
81
+ max_delay: 1.0,
82
+ multiplier: 1.2,
83
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
84
+ }
85
+
86
+ default_config.rpcs.patch_traces.timeout = 45.0
87
+ default_config.rpcs.patch_traces.retry_policy = {
88
+ initial_delay: 0.1,
89
+ max_delay: 1.0,
90
+ multiplier: 1.2,
91
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
92
+ }
93
+
94
+ default_config
95
+ end
96
+ yield @configure if block_given?
97
+ @configure
98
+ end
99
+
100
+ ##
101
+ # Configure the TraceService Client instance.
102
+ #
103
+ # The configuration is set to the derived mode, meaning that values can be changed,
104
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
105
+ # should be made on {Client.configure}.
106
+ #
107
+ # See {::Google::Cloud::Trace::V1::TraceService::Client::Configuration}
108
+ # for a description of the configuration fields.
109
+ #
110
+ # @yield [config] Configure the Client client.
111
+ # @yieldparam config [Client::Configuration]
112
+ #
113
+ # @return [Client::Configuration]
114
+ #
115
+ def configure
116
+ yield @config if block_given?
117
+ @config
118
+ end
119
+
120
+ ##
121
+ # Create a new TraceService client object.
122
+ #
123
+ # ## Examples
124
+ #
125
+ # To create a new TraceService client with the default
126
+ # configuration:
127
+ #
128
+ # client = ::Google::Cloud::Trace::V1::TraceService::Client.new
129
+ #
130
+ # To create a new TraceService client with a custom
131
+ # configuration:
132
+ #
133
+ # client = ::Google::Cloud::Trace::V1::TraceService::Client.new do |config|
134
+ # config.timeout = 10.0
135
+ # end
136
+ #
137
+ # @yield [config] Configure the TraceService client.
138
+ # @yieldparam config [Client::Configuration]
139
+ #
140
+ def initialize
141
+ # These require statements are intentionally placed here to initialize
142
+ # the gRPC module only when it's required.
143
+ # See https://github.com/googleapis/toolkit/issues/446
144
+ require "gapic/grpc"
145
+ require "google/devtools/cloudtrace/v1/trace_services_pb"
146
+
147
+ # Create the configuration object
148
+ @config = Configuration.new Client.configure
149
+
150
+ # Yield the configuration if needed
151
+ yield @config if block_given?
152
+
153
+ # Create credentials
154
+ credentials = @config.credentials
155
+ credentials ||= Credentials.default scope: @config.scope
156
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
157
+ credentials = Credentials.new credentials, scope: @config.scope
158
+ end
159
+ @quota_project_id = @config.quota_project
160
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
161
+
162
+ @trace_service_stub = ::Gapic::ServiceStub.new(
163
+ ::Google::Cloud::Trace::V1::TraceService::Stub,
164
+ credentials: credentials,
165
+ endpoint: @config.endpoint,
166
+ channel_args: @config.channel_args,
167
+ interceptors: @config.interceptors
168
+ )
169
+ end
170
+
171
+ # Service calls
172
+
173
+ ##
174
+ # Returns of a list of traces that match the specified filter conditions.
175
+ #
176
+ # @overload list_traces(request, options = nil)
177
+ # Pass arguments to `list_traces` via a request object, either of type
178
+ # {::Google::Cloud::Trace::V1::ListTracesRequest} or an equivalent Hash.
179
+ #
180
+ # @param request [::Google::Cloud::Trace::V1::ListTracesRequest, ::Hash]
181
+ # A request object representing the call parameters. Required. To specify no
182
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
183
+ # @param options [::Gapic::CallOptions, ::Hash]
184
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
185
+ #
186
+ # @overload list_traces(project_id: nil, view: nil, page_size: nil, page_token: nil, start_time: nil, end_time: nil, filter: nil, order_by: nil)
187
+ # Pass arguments to `list_traces` via keyword arguments. Note that at
188
+ # least one keyword argument is required. To specify no parameters, or to keep all
189
+ # the default parameter values, pass an empty Hash as a request object (see above).
190
+ #
191
+ # @param project_id [::String]
192
+ # Required. ID of the Cloud project where the trace data is stored.
193
+ # @param view [::Google::Cloud::Trace::V1::ListTracesRequest::ViewType]
194
+ # Optional. Type of data returned for traces in the list. Default is
195
+ # `MINIMAL`.
196
+ # @param page_size [::Integer]
197
+ # Optional. Maximum number of traces to return. If not specified or <= 0, the
198
+ # implementation selects a reasonable value. The implementation may
199
+ # return fewer traces than the requested page size.
200
+ # @param page_token [::String]
201
+ # Token identifying the page of results to return. If provided, use the
202
+ # value of the `next_page_token` field from a previous request.
203
+ # @param start_time [::Google::Protobuf::Timestamp, ::Hash]
204
+ # Start of the time interval (inclusive) during which the trace data was
205
+ # collected from the application.
206
+ # @param end_time [::Google::Protobuf::Timestamp, ::Hash]
207
+ # End of the time interval (inclusive) during which the trace data was
208
+ # collected from the application.
209
+ # @param filter [::String]
210
+ # Optional. A filter against labels for the request.
211
+ #
212
+ # By default, searches use prefix matching. To specify exact match, prepend
213
+ # a plus symbol (`+`) to the search term.
214
+ # Multiple terms are ANDed. Syntax:
215
+ #
216
+ # * `root:NAME_PREFIX` or `NAME_PREFIX`: Return traces where any root
217
+ # span starts with `NAME_PREFIX`.
218
+ # * `+root:NAME` or `+NAME`: Return traces where any root span's name is
219
+ # exactly `NAME`.
220
+ # * `span:NAME_PREFIX`: Return traces where any span starts with
221
+ # `NAME_PREFIX`.
222
+ # * `+span:NAME`: Return traces where any span's name is exactly
223
+ # `NAME`.
224
+ # * `latency:DURATION`: Return traces whose overall latency is
225
+ # greater or equal to than `DURATION`. Accepted units are nanoseconds
226
+ # (`ns`), milliseconds (`ms`), and seconds (`s`). Default is `ms`. For
227
+ # example, `latency:24ms` returns traces whose overall latency
228
+ # is greater than or equal to 24 milliseconds.
229
+ # * `label:LABEL_KEY`: Return all traces containing the specified
230
+ # label key (exact match, case-sensitive) regardless of the key:value
231
+ # pair's value (including empty values).
232
+ # * `LABEL_KEY:VALUE_PREFIX`: Return all traces containing the specified
233
+ # label key (exact match, case-sensitive) whose value starts with
234
+ # `VALUE_PREFIX`. Both a key and a value must be specified.
235
+ # * `+LABEL_KEY:VALUE`: Return all traces containing a key:value pair
236
+ # exactly matching the specified text. Both a key and a value must be
237
+ # specified.
238
+ # * `method:VALUE`: Equivalent to `/http/method:VALUE`.
239
+ # * `url:VALUE`: Equivalent to `/http/url:VALUE`.
240
+ # @param order_by [::String]
241
+ # Optional. Field used to sort the returned traces.
242
+ # Can be one of the following:
243
+ #
244
+ # * `trace_id`
245
+ # * `name` (`name` field of root span in the trace)
246
+ # * `duration` (difference between `end_time` and `start_time` fields of
247
+ # the root span)
248
+ # * `start` (`start_time` field of the root span)
249
+ #
250
+ # Descending order can be specified by appending `desc` to the sort field
251
+ # (for example, `name desc`).
252
+ #
253
+ # Only one sort field is permitted.
254
+ #
255
+ # @yield [response, operation] Access the result along with the RPC operation
256
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Trace::V1::Trace>]
257
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
258
+ #
259
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Trace::V1::Trace>]
260
+ #
261
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
262
+ #
263
+ def list_traces request, options = nil
264
+ raise ::ArgumentError, "request must be provided" if request.nil?
265
+
266
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Trace::V1::ListTracesRequest
267
+
268
+ # Converts hash and nil to an options object
269
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
270
+
271
+ # Customize the options with defaults
272
+ metadata = @config.rpcs.list_traces.metadata.to_h
273
+
274
+ # Set x-goog-api-client and x-goog-user-project headers
275
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
276
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
277
+ gapic_version: ::Google::Cloud::Trace::V1::VERSION
278
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
279
+
280
+ header_params = {
281
+ "project_id" => request.project_id
282
+ }
283
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
284
+ metadata[:"x-goog-request-params"] ||= request_params_header
285
+
286
+ options.apply_defaults timeout: @config.rpcs.list_traces.timeout,
287
+ metadata: metadata,
288
+ retry_policy: @config.rpcs.list_traces.retry_policy
289
+ options.apply_defaults metadata: @config.metadata,
290
+ retry_policy: @config.retry_policy
291
+
292
+ @trace_service_stub.call_rpc :list_traces, request, options: options do |response, operation|
293
+ response = ::Gapic::PagedEnumerable.new @trace_service_stub, :list_traces, request, response, operation, options
294
+ yield response, operation if block_given?
295
+ return response
296
+ end
297
+ rescue ::GRPC::BadStatus => e
298
+ raise ::Google::Cloud::Error.from_error(e)
299
+ end
300
+
301
+ ##
302
+ # Gets a single trace by its ID.
303
+ #
304
+ # @overload get_trace(request, options = nil)
305
+ # Pass arguments to `get_trace` via a request object, either of type
306
+ # {::Google::Cloud::Trace::V1::GetTraceRequest} or an equivalent Hash.
307
+ #
308
+ # @param request [::Google::Cloud::Trace::V1::GetTraceRequest, ::Hash]
309
+ # A request object representing the call parameters. Required. To specify no
310
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
311
+ # @param options [::Gapic::CallOptions, ::Hash]
312
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
313
+ #
314
+ # @overload get_trace(project_id: nil, trace_id: nil)
315
+ # Pass arguments to `get_trace` via keyword arguments. Note that at
316
+ # least one keyword argument is required. To specify no parameters, or to keep all
317
+ # the default parameter values, pass an empty Hash as a request object (see above).
318
+ #
319
+ # @param project_id [::String]
320
+ # Required. ID of the Cloud project where the trace data is stored.
321
+ # @param trace_id [::String]
322
+ # Required. ID of the trace to return.
323
+ #
324
+ # @yield [response, operation] Access the result along with the RPC operation
325
+ # @yieldparam response [::Google::Cloud::Trace::V1::Trace]
326
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
327
+ #
328
+ # @return [::Google::Cloud::Trace::V1::Trace]
329
+ #
330
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
331
+ #
332
+ def get_trace request, options = nil
333
+ raise ::ArgumentError, "request must be provided" if request.nil?
334
+
335
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Trace::V1::GetTraceRequest
336
+
337
+ # Converts hash and nil to an options object
338
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
339
+
340
+ # Customize the options with defaults
341
+ metadata = @config.rpcs.get_trace.metadata.to_h
342
+
343
+ # Set x-goog-api-client and x-goog-user-project headers
344
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
345
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
346
+ gapic_version: ::Google::Cloud::Trace::V1::VERSION
347
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
348
+
349
+ header_params = {
350
+ "project_id" => request.project_id,
351
+ "trace_id" => request.trace_id
352
+ }
353
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
354
+ metadata[:"x-goog-request-params"] ||= request_params_header
355
+
356
+ options.apply_defaults timeout: @config.rpcs.get_trace.timeout,
357
+ metadata: metadata,
358
+ retry_policy: @config.rpcs.get_trace.retry_policy
359
+ options.apply_defaults metadata: @config.metadata,
360
+ retry_policy: @config.retry_policy
361
+
362
+ @trace_service_stub.call_rpc :get_trace, request, options: options do |response, operation|
363
+ yield response, operation if block_given?
364
+ return response
365
+ end
366
+ rescue ::GRPC::BadStatus => e
367
+ raise ::Google::Cloud::Error.from_error(e)
368
+ end
369
+
370
+ ##
371
+ # Sends new traces to Stackdriver Trace or updates existing traces. If the ID
372
+ # of a trace that you send matches that of an existing trace, any fields
373
+ # in the existing trace and its spans are overwritten by the provided values,
374
+ # and any new fields provided are merged with the existing trace data. If the
375
+ # ID does not match, a new trace is created.
376
+ #
377
+ # @overload patch_traces(request, options = nil)
378
+ # Pass arguments to `patch_traces` via a request object, either of type
379
+ # {::Google::Cloud::Trace::V1::PatchTracesRequest} or an equivalent Hash.
380
+ #
381
+ # @param request [::Google::Cloud::Trace::V1::PatchTracesRequest, ::Hash]
382
+ # A request object representing the call parameters. Required. To specify no
383
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
384
+ # @param options [::Gapic::CallOptions, ::Hash]
385
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
386
+ #
387
+ # @overload patch_traces(project_id: nil, traces: nil)
388
+ # Pass arguments to `patch_traces` via keyword arguments. Note that at
389
+ # least one keyword argument is required. To specify no parameters, or to keep all
390
+ # the default parameter values, pass an empty Hash as a request object (see above).
391
+ #
392
+ # @param project_id [::String]
393
+ # Required. ID of the Cloud project where the trace data is stored.
394
+ # @param traces [::Google::Cloud::Trace::V1::Traces, ::Hash]
395
+ # Required. The body of the message.
396
+ #
397
+ # @yield [response, operation] Access the result along with the RPC operation
398
+ # @yieldparam response [::Google::Protobuf::Empty]
399
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
400
+ #
401
+ # @return [::Google::Protobuf::Empty]
402
+ #
403
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
404
+ #
405
+ def patch_traces request, options = nil
406
+ raise ::ArgumentError, "request must be provided" if request.nil?
407
+
408
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Trace::V1::PatchTracesRequest
409
+
410
+ # Converts hash and nil to an options object
411
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
412
+
413
+ # Customize the options with defaults
414
+ metadata = @config.rpcs.patch_traces.metadata.to_h
415
+
416
+ # Set x-goog-api-client and x-goog-user-project headers
417
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
418
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
419
+ gapic_version: ::Google::Cloud::Trace::V1::VERSION
420
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
421
+
422
+ header_params = {
423
+ "project_id" => request.project_id
424
+ }
425
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
426
+ metadata[:"x-goog-request-params"] ||= request_params_header
427
+
428
+ options.apply_defaults timeout: @config.rpcs.patch_traces.timeout,
429
+ metadata: metadata,
430
+ retry_policy: @config.rpcs.patch_traces.retry_policy
431
+ options.apply_defaults metadata: @config.metadata,
432
+ retry_policy: @config.retry_policy
433
+
434
+ @trace_service_stub.call_rpc :patch_traces, request, options: options do |response, operation|
435
+ yield response, operation if block_given?
436
+ return response
437
+ end
438
+ rescue ::GRPC::BadStatus => e
439
+ raise ::Google::Cloud::Error.from_error(e)
440
+ end
441
+
442
+ ##
443
+ # Configuration class for the TraceService API.
444
+ #
445
+ # This class represents the configuration for TraceService,
446
+ # providing control over timeouts, retry behavior, logging, transport
447
+ # parameters, and other low-level controls. Certain parameters can also be
448
+ # applied individually to specific RPCs. See
449
+ # {::Google::Cloud::Trace::V1::TraceService::Client::Configuration::Rpcs}
450
+ # for a list of RPCs that can be configured independently.
451
+ #
452
+ # Configuration can be applied globally to all clients, or to a single client
453
+ # on construction.
454
+ #
455
+ # # Examples
456
+ #
457
+ # To modify the global config, setting the timeout for list_traces
458
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
459
+ #
460
+ # ::Google::Cloud::Trace::V1::TraceService::Client.configure do |config|
461
+ # config.timeout = 10.0
462
+ # config.rpcs.list_traces.timeout = 20.0
463
+ # end
464
+ #
465
+ # To apply the above configuration only to a new client:
466
+ #
467
+ # client = ::Google::Cloud::Trace::V1::TraceService::Client.new do |config|
468
+ # config.timeout = 10.0
469
+ # config.rpcs.list_traces.timeout = 20.0
470
+ # end
471
+ #
472
+ # @!attribute [rw] endpoint
473
+ # The hostname or hostname:port of the service endpoint.
474
+ # Defaults to `"cloudtrace.googleapis.com"`.
475
+ # @return [::String]
476
+ # @!attribute [rw] credentials
477
+ # Credentials to send with calls. You may provide any of the following types:
478
+ # * (`String`) The path to a service account key file in JSON format
479
+ # * (`Hash`) A service account key as a Hash
480
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
481
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
482
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
483
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
484
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
485
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
486
+ # * (`nil`) indicating no credentials
487
+ # @return [::Object]
488
+ # @!attribute [rw] scope
489
+ # The OAuth scopes
490
+ # @return [::Array<::String>]
491
+ # @!attribute [rw] lib_name
492
+ # The library name as recorded in instrumentation and logging
493
+ # @return [::String]
494
+ # @!attribute [rw] lib_version
495
+ # The library version as recorded in instrumentation and logging
496
+ # @return [::String]
497
+ # @!attribute [rw] channel_args
498
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
499
+ # `GRPC::Core::Channel` object is provided as the credential.
500
+ # @return [::Hash]
501
+ # @!attribute [rw] interceptors
502
+ # An array of interceptors that are run before calls are executed.
503
+ # @return [::Array<::GRPC::ClientInterceptor>]
504
+ # @!attribute [rw] timeout
505
+ # The call timeout in seconds.
506
+ # @return [::Numeric]
507
+ # @!attribute [rw] metadata
508
+ # Additional gRPC headers to be sent with the call.
509
+ # @return [::Hash{::Symbol=>::String}]
510
+ # @!attribute [rw] retry_policy
511
+ # The retry policy. The value is a hash with the following keys:
512
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
513
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
514
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
515
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
516
+ # trigger a retry.
517
+ # @return [::Hash]
518
+ # @!attribute [rw] quota_project
519
+ # A separate project against which to charge quota.
520
+ # @return [::String]
521
+ #
522
+ class Configuration
523
+ extend ::Gapic::Config
524
+
525
+ config_attr :endpoint, "cloudtrace.googleapis.com", ::String
526
+ config_attr :credentials, nil do |value|
527
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
528
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
529
+ allowed.any? { |klass| klass === value }
530
+ end
531
+ config_attr :scope, nil, ::String, ::Array, nil
532
+ config_attr :lib_name, nil, ::String, nil
533
+ config_attr :lib_version, nil, ::String, nil
534
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
535
+ config_attr :interceptors, nil, ::Array, nil
536
+ config_attr :timeout, nil, ::Numeric, nil
537
+ config_attr :metadata, nil, ::Hash, nil
538
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
539
+ config_attr :quota_project, nil, ::String, nil
540
+
541
+ # @private
542
+ def initialize parent_config = nil
543
+ @parent_config = parent_config unless parent_config.nil?
544
+
545
+ yield self if block_given?
546
+ end
547
+
548
+ ##
549
+ # Configurations for individual RPCs
550
+ # @return [Rpcs]
551
+ #
552
+ def rpcs
553
+ @rpcs ||= begin
554
+ parent_rpcs = nil
555
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
556
+ Rpcs.new parent_rpcs
557
+ end
558
+ end
559
+
560
+ ##
561
+ # Configuration RPC class for the TraceService API.
562
+ #
563
+ # Includes fields providing the configuration for each RPC in this service.
564
+ # Each configuration object is of type `Gapic::Config::Method` and includes
565
+ # the following configuration fields:
566
+ #
567
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
568
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
569
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
570
+ # include the following keys:
571
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
572
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
573
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
574
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
575
+ # trigger a retry.
576
+ #
577
+ class Rpcs
578
+ ##
579
+ # RPC-specific configuration for `list_traces`
580
+ # @return [::Gapic::Config::Method]
581
+ #
582
+ attr_reader :list_traces
583
+ ##
584
+ # RPC-specific configuration for `get_trace`
585
+ # @return [::Gapic::Config::Method]
586
+ #
587
+ attr_reader :get_trace
588
+ ##
589
+ # RPC-specific configuration for `patch_traces`
590
+ # @return [::Gapic::Config::Method]
591
+ #
592
+ attr_reader :patch_traces
593
+
594
+ # @private
595
+ def initialize parent_rpcs = nil
596
+ list_traces_config = parent_rpcs&.list_traces if parent_rpcs&.respond_to? :list_traces
597
+ @list_traces = ::Gapic::Config::Method.new list_traces_config
598
+ get_trace_config = parent_rpcs&.get_trace if parent_rpcs&.respond_to? :get_trace
599
+ @get_trace = ::Gapic::Config::Method.new get_trace_config
600
+ patch_traces_config = parent_rpcs&.patch_traces if parent_rpcs&.respond_to? :patch_traces
601
+ @patch_traces = ::Gapic::Config::Method.new patch_traces_config
602
+
603
+ yield self if block_given?
604
+ end
605
+ end
606
+ end
607
+ end
608
+ end
609
+ end
610
+ end
611
+ end
612
+ end