google-cloud-trace-v2 0.1.0

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.
@@ -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/v2"
@@ -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/v2/trace_service"
20
+ require "google/cloud/trace/v2/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/v2"
29
+ # client = ::Google::Cloud::Trace::V2::TraceService::Client.new
30
+ #
31
+ module V2
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,53 @@
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/v2/version"
24
+
25
+ require "google/cloud/trace/v2/trace_service/credentials"
26
+ require "google/cloud/trace/v2/trace_service/paths"
27
+ require "google/cloud/trace/v2/trace_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Trace
32
+ module V2
33
+ ##
34
+ # This file describes an API for collecting and viewing traces and spans
35
+ # within a trace. A Trace is a collection of spans corresponding to a single
36
+ # operation or set of operations for an application. A span is an individual
37
+ # timed event which forms a node of the trace tree. A single trace may
38
+ # contain span(s) from multiple services.
39
+ #
40
+ # To load this service and instantiate a client:
41
+ #
42
+ # require "google/cloud/trace/v2/trace_service"
43
+ # client = ::Google::Cloud::Trace::V2::TraceService::Client.new
44
+ #
45
+ module TraceService
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "trace_service", "helpers.rb"
53
+ require "google/cloud/trace/v2/trace_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,514 @@
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/v2/tracing_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Trace
25
+ module V2
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. A single trace may
34
+ # contain span(s) from multiple services.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :trace_service_stub
41
+
42
+ ##
43
+ # Configure the TraceService Client class.
44
+ #
45
+ # See {::Google::Cloud::Trace::V2::TraceService::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # ## Example
49
+ #
50
+ # To modify the configuration for all TraceService clients:
51
+ #
52
+ # ::Google::Cloud::Trace::V2::TraceService::Client.configure do |config|
53
+ # config.timeout = 10.0
54
+ # end
55
+ #
56
+ # @yield [config] Configure the Client client.
57
+ # @yieldparam config [Client::Configuration]
58
+ #
59
+ # @return [Client::Configuration]
60
+ #
61
+ def self.configure
62
+ @configure ||= begin
63
+ namespace = ["Google", "Cloud", "Trace", "V2"]
64
+ parent_config = while namespace.any?
65
+ parent_name = namespace.join "::"
66
+ parent_const = const_get parent_name
67
+ break parent_const.configure if parent_const&.respond_to? :configure
68
+ namespace.pop
69
+ end
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config.rpcs.batch_write_spans.timeout = 120.0
73
+
74
+ default_config.rpcs.create_span.timeout = 120.0
75
+ default_config.rpcs.create_span.retry_policy = {
76
+ initial_delay: 0.1,
77
+ max_delay: 1.0,
78
+ multiplier: 1.2,
79
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
80
+ }
81
+
82
+ default_config
83
+ end
84
+ yield @configure if block_given?
85
+ @configure
86
+ end
87
+
88
+ ##
89
+ # Configure the TraceService Client instance.
90
+ #
91
+ # The configuration is set to the derived mode, meaning that values can be changed,
92
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
93
+ # should be made on {Client.configure}.
94
+ #
95
+ # See {::Google::Cloud::Trace::V2::TraceService::Client::Configuration}
96
+ # for a description of the configuration fields.
97
+ #
98
+ # @yield [config] Configure the Client client.
99
+ # @yieldparam config [Client::Configuration]
100
+ #
101
+ # @return [Client::Configuration]
102
+ #
103
+ def configure
104
+ yield @config if block_given?
105
+ @config
106
+ end
107
+
108
+ ##
109
+ # Create a new TraceService client object.
110
+ #
111
+ # ## Examples
112
+ #
113
+ # To create a new TraceService client with the default
114
+ # configuration:
115
+ #
116
+ # client = ::Google::Cloud::Trace::V2::TraceService::Client.new
117
+ #
118
+ # To create a new TraceService client with a custom
119
+ # configuration:
120
+ #
121
+ # client = ::Google::Cloud::Trace::V2::TraceService::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
124
+ #
125
+ # @yield [config] Configure the TraceService client.
126
+ # @yieldparam config [Client::Configuration]
127
+ #
128
+ def initialize
129
+ # These require statements are intentionally placed here to initialize
130
+ # the gRPC module only when it's required.
131
+ # See https://github.com/googleapis/toolkit/issues/446
132
+ require "gapic/grpc"
133
+ require "google/devtools/cloudtrace/v2/tracing_services_pb"
134
+
135
+ # Create the configuration object
136
+ @config = Configuration.new Client.configure
137
+
138
+ # Yield the configuration if needed
139
+ yield @config if block_given?
140
+
141
+ # Create credentials
142
+ credentials = @config.credentials
143
+ credentials ||= Credentials.default scope: @config.scope
144
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+ @quota_project_id = @config.quota_project
148
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
149
+
150
+ @trace_service_stub = ::Gapic::ServiceStub.new(
151
+ ::Google::Cloud::Trace::V2::TraceService::Stub,
152
+ credentials: credentials,
153
+ endpoint: @config.endpoint,
154
+ channel_args: @config.channel_args,
155
+ interceptors: @config.interceptors
156
+ )
157
+ end
158
+
159
+ # Service calls
160
+
161
+ ##
162
+ # Sends new spans to new or existing traces. You cannot update
163
+ # existing spans.
164
+ #
165
+ # @overload batch_write_spans(request, options = nil)
166
+ # Pass arguments to `batch_write_spans` via a request object, either of type
167
+ # {::Google::Cloud::Trace::V2::BatchWriteSpansRequest} or an equivalent Hash.
168
+ #
169
+ # @param request [::Google::Cloud::Trace::V2::BatchWriteSpansRequest, ::Hash]
170
+ # A request object representing the call parameters. Required. To specify no
171
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
172
+ # @param options [::Gapic::CallOptions, ::Hash]
173
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
174
+ #
175
+ # @overload batch_write_spans(name: nil, spans: nil)
176
+ # Pass arguments to `batch_write_spans` via keyword arguments. Note that at
177
+ # least one keyword argument is required. To specify no parameters, or to keep all
178
+ # the default parameter values, pass an empty Hash as a request object (see above).
179
+ #
180
+ # @param name [::String]
181
+ # Required. The name of the project where the spans belong. The format is
182
+ # `projects/[PROJECT_ID]`.
183
+ # @param spans [::Array<::Google::Cloud::Trace::V2::Span, ::Hash>]
184
+ # Required. A list of new spans. The span names must not match existing
185
+ # spans, or the results are undefined.
186
+ #
187
+ # @yield [response, operation] Access the result along with the RPC operation
188
+ # @yieldparam response [::Google::Protobuf::Empty]
189
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
190
+ #
191
+ # @return [::Google::Protobuf::Empty]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
194
+ #
195
+ def batch_write_spans request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Trace::V2::BatchWriteSpansRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ metadata = @config.rpcs.batch_write_spans.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::Trace::V2::VERSION
210
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
211
+
212
+ header_params = {
213
+ "name" => request.name
214
+ }
215
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
216
+ metadata[:"x-goog-request-params"] ||= request_params_header
217
+
218
+ options.apply_defaults timeout: @config.rpcs.batch_write_spans.timeout,
219
+ metadata: metadata,
220
+ retry_policy: @config.rpcs.batch_write_spans.retry_policy
221
+ options.apply_defaults metadata: @config.metadata,
222
+ retry_policy: @config.retry_policy
223
+
224
+ @trace_service_stub.call_rpc :batch_write_spans, request, options: options do |response, operation|
225
+ yield response, operation if block_given?
226
+ return response
227
+ end
228
+ rescue ::GRPC::BadStatus => e
229
+ raise ::Google::Cloud::Error.from_error(e)
230
+ end
231
+
232
+ ##
233
+ # Creates a new span.
234
+ #
235
+ # @overload create_span(request, options = nil)
236
+ # Pass arguments to `create_span` via a request object, either of type
237
+ # {::Google::Cloud::Trace::V2::Span} or an equivalent Hash.
238
+ #
239
+ # @param request [::Google::Cloud::Trace::V2::Span, ::Hash]
240
+ # A request object representing the call parameters. Required. To specify no
241
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
242
+ # @param options [::Gapic::CallOptions, ::Hash]
243
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
244
+ #
245
+ # @overload create_span(name: nil, span_id: nil, parent_span_id: nil, display_name: nil, start_time: nil, end_time: nil, attributes: nil, stack_trace: nil, time_events: nil, links: nil, status: nil, same_process_as_parent_span: nil, child_span_count: nil, span_kind: nil)
246
+ # Pass arguments to `create_span` via keyword arguments. Note that at
247
+ # least one keyword argument is required. To specify no parameters, or to keep all
248
+ # the default parameter values, pass an empty Hash as a request object (see above).
249
+ #
250
+ # @param name [::String]
251
+ # Required. The resource name of the span in the following format:
252
+ #
253
+ # projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
254
+ #
255
+ # [TRACE_ID] is a unique identifier for a trace within a project;
256
+ # it is a 32-character hexadecimal encoding of a 16-byte array.
257
+ #
258
+ # [SPAN_ID] is a unique identifier for a span within a trace; it
259
+ # is a 16-character hexadecimal encoding of an 8-byte array.
260
+ # @param span_id [::String]
261
+ # Required. The [SPAN_ID] portion of the span's resource name.
262
+ # @param parent_span_id [::String]
263
+ # The [SPAN_ID] of this span's parent span. If this is a root span,
264
+ # then this field must be empty.
265
+ # @param display_name [::Google::Cloud::Trace::V2::TruncatableString, ::Hash]
266
+ # Required. A description of the span's operation (up to 128 bytes).
267
+ # Stackdriver Trace displays the description in the
268
+ # Google Cloud Platform Console.
269
+ # For example, the display name can be a qualified method name or a file name
270
+ # and a line number where the operation is called. A best practice is to use
271
+ # the same display name within an application and at the same call point.
272
+ # This makes it easier to correlate spans in different traces.
273
+ # @param start_time [::Google::Protobuf::Timestamp, ::Hash]
274
+ # Required. The start time of the span. On the client side, this is the time kept by
275
+ # the local machine where the span execution starts. On the server side, this
276
+ # is the time when the server's application handler starts running.
277
+ # @param end_time [::Google::Protobuf::Timestamp, ::Hash]
278
+ # Required. The end time of the span. On the client side, this is the time kept by
279
+ # the local machine where the span execution ends. On the server side, this
280
+ # is the time when the server application handler stops running.
281
+ # @param attributes [::Google::Cloud::Trace::V2::Span::Attributes, ::Hash]
282
+ # A set of attributes on the span. You can have up to 32 attributes per
283
+ # span.
284
+ # @param stack_trace [::Google::Cloud::Trace::V2::StackTrace, ::Hash]
285
+ # Stack trace captured at the start of the span.
286
+ # @param time_events [::Google::Cloud::Trace::V2::Span::TimeEvents, ::Hash]
287
+ # A set of time events. You can have up to 32 annotations and 128 message
288
+ # events per span.
289
+ # @param links [::Google::Cloud::Trace::V2::Span::Links, ::Hash]
290
+ # Links associated with the span. You can have up to 128 links per Span.
291
+ # @param status [::Google::Rpc::Status, ::Hash]
292
+ # Optional. The final status for this span.
293
+ # @param same_process_as_parent_span [::Google::Protobuf::BoolValue, ::Hash]
294
+ # Optional. Set this parameter to indicate whether this span is in
295
+ # the same process as its parent. If you do not set this parameter,
296
+ # Stackdriver Trace is unable to take advantage of this helpful
297
+ # information.
298
+ # @param child_span_count [::Google::Protobuf::Int32Value, ::Hash]
299
+ # Optional. The number of child spans that were generated while this span
300
+ # was active. If set, allows implementation to detect missing child spans.
301
+ # @param span_kind [::Google::Cloud::Trace::V2::Span::SpanKind]
302
+ # Optional. Distinguishes between spans generated in a particular context. For example,
303
+ # two spans with the same name may be distinguished using `CLIENT` (caller)
304
+ # and `SERVER` (callee) to identify an RPC call.
305
+ #
306
+ # @yield [response, operation] Access the result along with the RPC operation
307
+ # @yieldparam response [::Google::Cloud::Trace::V2::Span]
308
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
309
+ #
310
+ # @return [::Google::Cloud::Trace::V2::Span]
311
+ #
312
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
313
+ #
314
+ def create_span request, options = nil
315
+ raise ::ArgumentError, "request must be provided" if request.nil?
316
+
317
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Trace::V2::Span
318
+
319
+ # Converts hash and nil to an options object
320
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
321
+
322
+ # Customize the options with defaults
323
+ metadata = @config.rpcs.create_span.metadata.to_h
324
+
325
+ # Set x-goog-api-client and x-goog-user-project headers
326
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
327
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
328
+ gapic_version: ::Google::Cloud::Trace::V2::VERSION
329
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
330
+
331
+ header_params = {
332
+ "name" => request.name
333
+ }
334
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
335
+ metadata[:"x-goog-request-params"] ||= request_params_header
336
+
337
+ options.apply_defaults timeout: @config.rpcs.create_span.timeout,
338
+ metadata: metadata,
339
+ retry_policy: @config.rpcs.create_span.retry_policy
340
+ options.apply_defaults metadata: @config.metadata,
341
+ retry_policy: @config.retry_policy
342
+
343
+ @trace_service_stub.call_rpc :create_span, request, options: options do |response, operation|
344
+ yield response, operation if block_given?
345
+ return response
346
+ end
347
+ rescue ::GRPC::BadStatus => e
348
+ raise ::Google::Cloud::Error.from_error(e)
349
+ end
350
+
351
+ ##
352
+ # Configuration class for the TraceService API.
353
+ #
354
+ # This class represents the configuration for TraceService,
355
+ # providing control over timeouts, retry behavior, logging, transport
356
+ # parameters, and other low-level controls. Certain parameters can also be
357
+ # applied individually to specific RPCs. See
358
+ # {::Google::Cloud::Trace::V2::TraceService::Client::Configuration::Rpcs}
359
+ # for a list of RPCs that can be configured independently.
360
+ #
361
+ # Configuration can be applied globally to all clients, or to a single client
362
+ # on construction.
363
+ #
364
+ # # Examples
365
+ #
366
+ # To modify the global config, setting the timeout for batch_write_spans
367
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
368
+ #
369
+ # ::Google::Cloud::Trace::V2::TraceService::Client.configure do |config|
370
+ # config.timeout = 10.0
371
+ # config.rpcs.batch_write_spans.timeout = 20.0
372
+ # end
373
+ #
374
+ # To apply the above configuration only to a new client:
375
+ #
376
+ # client = ::Google::Cloud::Trace::V2::TraceService::Client.new do |config|
377
+ # config.timeout = 10.0
378
+ # config.rpcs.batch_write_spans.timeout = 20.0
379
+ # end
380
+ #
381
+ # @!attribute [rw] endpoint
382
+ # The hostname or hostname:port of the service endpoint.
383
+ # Defaults to `"cloudtrace.googleapis.com"`.
384
+ # @return [::String]
385
+ # @!attribute [rw] credentials
386
+ # Credentials to send with calls. You may provide any of the following types:
387
+ # * (`String`) The path to a service account key file in JSON format
388
+ # * (`Hash`) A service account key as a Hash
389
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
390
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
391
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
392
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
393
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
394
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
395
+ # * (`nil`) indicating no credentials
396
+ # @return [::Object]
397
+ # @!attribute [rw] scope
398
+ # The OAuth scopes
399
+ # @return [::Array<::String>]
400
+ # @!attribute [rw] lib_name
401
+ # The library name as recorded in instrumentation and logging
402
+ # @return [::String]
403
+ # @!attribute [rw] lib_version
404
+ # The library version as recorded in instrumentation and logging
405
+ # @return [::String]
406
+ # @!attribute [rw] channel_args
407
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
408
+ # `GRPC::Core::Channel` object is provided as the credential.
409
+ # @return [::Hash]
410
+ # @!attribute [rw] interceptors
411
+ # An array of interceptors that are run before calls are executed.
412
+ # @return [::Array<::GRPC::ClientInterceptor>]
413
+ # @!attribute [rw] timeout
414
+ # The call timeout in seconds.
415
+ # @return [::Numeric]
416
+ # @!attribute [rw] metadata
417
+ # Additional gRPC headers to be sent with the call.
418
+ # @return [::Hash{::Symbol=>::String}]
419
+ # @!attribute [rw] retry_policy
420
+ # The retry policy. The value is a hash with the following keys:
421
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
422
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
423
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
424
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
425
+ # trigger a retry.
426
+ # @return [::Hash]
427
+ # @!attribute [rw] quota_project
428
+ # A separate project against which to charge quota.
429
+ # @return [::String]
430
+ #
431
+ class Configuration
432
+ extend ::Gapic::Config
433
+
434
+ config_attr :endpoint, "cloudtrace.googleapis.com", ::String
435
+ config_attr :credentials, nil do |value|
436
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
437
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
438
+ allowed.any? { |klass| klass === value }
439
+ end
440
+ config_attr :scope, nil, ::String, ::Array, nil
441
+ config_attr :lib_name, nil, ::String, nil
442
+ config_attr :lib_version, nil, ::String, nil
443
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
444
+ config_attr :interceptors, nil, ::Array, nil
445
+ config_attr :timeout, nil, ::Numeric, nil
446
+ config_attr :metadata, nil, ::Hash, nil
447
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
448
+ config_attr :quota_project, nil, ::String, nil
449
+
450
+ # @private
451
+ def initialize parent_config = nil
452
+ @parent_config = parent_config unless parent_config.nil?
453
+
454
+ yield self if block_given?
455
+ end
456
+
457
+ ##
458
+ # Configurations for individual RPCs
459
+ # @return [Rpcs]
460
+ #
461
+ def rpcs
462
+ @rpcs ||= begin
463
+ parent_rpcs = nil
464
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
465
+ Rpcs.new parent_rpcs
466
+ end
467
+ end
468
+
469
+ ##
470
+ # Configuration RPC class for the TraceService API.
471
+ #
472
+ # Includes fields providing the configuration for each RPC in this service.
473
+ # Each configuration object is of type `Gapic::Config::Method` and includes
474
+ # the following configuration fields:
475
+ #
476
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
477
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
478
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
479
+ # include the following keys:
480
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
481
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
482
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
483
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
484
+ # trigger a retry.
485
+ #
486
+ class Rpcs
487
+ ##
488
+ # RPC-specific configuration for `batch_write_spans`
489
+ # @return [::Gapic::Config::Method]
490
+ #
491
+ attr_reader :batch_write_spans
492
+ ##
493
+ # RPC-specific configuration for `create_span`
494
+ # @return [::Gapic::Config::Method]
495
+ #
496
+ attr_reader :create_span
497
+
498
+ # @private
499
+ def initialize parent_rpcs = nil
500
+ batch_write_spans_config = parent_rpcs&.batch_write_spans if parent_rpcs&.respond_to? :batch_write_spans
501
+ @batch_write_spans = ::Gapic::Config::Method.new batch_write_spans_config
502
+ create_span_config = parent_rpcs&.create_span if parent_rpcs&.respond_to? :create_span
503
+ @create_span = ::Gapic::Config::Method.new create_span_config
504
+
505
+ yield self if block_given?
506
+ end
507
+ end
508
+ end
509
+ end
510
+ end
511
+ end
512
+ end
513
+ end
514
+ end