google-cloud-trace-v1 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +3 -3
- data/lib/google/cloud/trace/v1/rest.rb +37 -0
- data/lib/google/cloud/trace/v1/trace_service/client.rb +4 -6
- data/lib/google/cloud/trace/v1/trace_service/rest/client.rb +569 -0
- data/lib/google/cloud/trace/v1/trace_service/rest/service_stub.rb +227 -0
- data/lib/google/cloud/trace/v1/trace_service/rest.rb +55 -0
- data/lib/google/cloud/trace/v1/trace_service.rb +7 -1
- data/lib/google/cloud/trace/v1/version.rb +1 -1
- data/lib/google/cloud/trace/v1.rb +7 -2
- data/lib/google/devtools/cloudtrace/v1/trace_pb.rb +0 -1
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +0 -2
- metadata +24 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90d4e9286c3a63b2dde9b4349c0984308a2c00d0128b15843b5128a8d2df5cca
|
4
|
+
data.tar.gz: ba13f021a35f733b54fe1027cab45c3c575efb609780c5705517b7ef8a239016
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80e0ed5b917016f4168f2e20b519c5c30b798a23143e1ddab8939530c01a273d39b38e6e63a362e443f273ffdb3be0d4e5f03a2e8f39149b677cafcf5156b95c
|
7
|
+
data.tar.gz: fb7110c14d9c6f8d9e49762a31f560b05e65f7fdf3413eff126f651e784e733c615b088e8b97f1e112db20394ca44fb2e235ab3eb9bcbb504d3a72db7ec5210d
|
data/AUTHENTICATION.md
CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
|
|
114
114
|
To configure your system for this, simply:
|
115
115
|
|
116
116
|
1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
|
117
|
-
2. Authenticate using OAuth 2.0 `$ gcloud auth login`
|
117
|
+
2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
|
118
118
|
3. Write code as if already authenticated.
|
119
119
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Ruby Client for the Cloud Trace V1 API
|
2
2
|
|
3
|
-
API
|
3
|
+
Sends application trace data to Stackdriver Trace for viewing. Trace data is collected for all App Engine applications by default. Trace data from other applications can be provided using this API. This library is used to interact with the Trace API directly. If you are looking to instrument your application for Stackdriver Trace, we recommend using OpenTelemetry.
|
4
4
|
|
5
|
-
The Cloud Trace API lets you send and retrieve latency data to and from Cloud Trace. This API provides low-level interfaces for interacting directly with the feature. For some languages, you can use
|
5
|
+
The Cloud Trace API lets you send and retrieve latency data to and from Cloud Trace. This API provides low-level interfaces for interacting directly with the feature. For some languages, you can use OpenTelemetry, a set of open source tracing and stats instrumentation libraries that work with multiple backends.
|
6
6
|
|
7
7
|
https://github.com/googleapis/google-cloud-ruby
|
8
8
|
|
@@ -46,7 +46,7 @@ for general usage information.
|
|
46
46
|
## Enabling Logging
|
47
47
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
50
50
|
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
51
51
|
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/rest"
|
20
|
+
require "google/cloud/trace/v1/version"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Trace
|
25
|
+
##
|
26
|
+
# To load just the REST part of this package, including all its services, and instantiate a REST client:
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
#
|
30
|
+
# require "google/cloud/trace/v1/rest"
|
31
|
+
# client = ::Google::Cloud::Trace::V1::TraceService::Rest::Client.new
|
32
|
+
#
|
33
|
+
module V1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -263,13 +263,11 @@ module Google
|
|
263
263
|
# # Call the list_traces method.
|
264
264
|
# result = client.list_traces request
|
265
265
|
#
|
266
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
267
|
-
# #
|
268
|
-
#
|
269
|
-
# # methods are also available for managing paging directly.
|
270
|
-
# result.each do |response|
|
266
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
267
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
268
|
+
# result.each do |item|
|
271
269
|
# # Each element is of type ::Google::Cloud::Trace::V1::Trace.
|
272
|
-
# p
|
270
|
+
# p item
|
273
271
|
# end
|
274
272
|
#
|
275
273
|
def list_traces request, options = nil
|
@@ -0,0 +1,569 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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
|
+
require "google/cloud/trace/v1/trace_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Trace
|
26
|
+
module V1
|
27
|
+
module TraceService
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the TraceService service.
|
31
|
+
#
|
32
|
+
# This file describes an API for collecting and viewing traces and spans
|
33
|
+
# within a trace. A Trace is a collection of spans corresponding to a single
|
34
|
+
# operation or set of operations for an application. A span is an individual
|
35
|
+
# timed event which forms a node of the trace tree. Spans for a single trace
|
36
|
+
# may span multiple services.
|
37
|
+
#
|
38
|
+
class Client
|
39
|
+
# @private
|
40
|
+
attr_reader :trace_service_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the TraceService Client class.
|
44
|
+
#
|
45
|
+
# See {::Google::Cloud::Trace::V1::TraceService::Rest::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# # Modify the configuration for all TraceService clients
|
51
|
+
# ::Google::Cloud::Trace::V1::TraceService::Rest::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Cloud", "Trace", "V1"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.rpcs.list_traces.timeout = 45.0
|
72
|
+
default_config.rpcs.list_traces.retry_policy = {
|
73
|
+
initial_delay: 0.1, max_delay: 1.0, multiplier: 1.2, retry_codes: [14, 4]
|
74
|
+
}
|
75
|
+
|
76
|
+
default_config.rpcs.get_trace.timeout = 45.0
|
77
|
+
default_config.rpcs.get_trace.retry_policy = {
|
78
|
+
initial_delay: 0.1, max_delay: 1.0, multiplier: 1.2, retry_codes: [14, 4]
|
79
|
+
}
|
80
|
+
|
81
|
+
default_config.rpcs.patch_traces.timeout = 45.0
|
82
|
+
default_config.rpcs.patch_traces.retry_policy = {
|
83
|
+
initial_delay: 0.1, max_delay: 1.0, multiplier: 1.2, retry_codes: [14, 4]
|
84
|
+
}
|
85
|
+
|
86
|
+
default_config
|
87
|
+
end
|
88
|
+
yield @configure if block_given?
|
89
|
+
@configure
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Configure the TraceService Client instance.
|
94
|
+
#
|
95
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
96
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
97
|
+
# should be made on {Client.configure}.
|
98
|
+
#
|
99
|
+
# See {::Google::Cloud::Trace::V1::TraceService::Rest::Client::Configuration}
|
100
|
+
# for a description of the configuration fields.
|
101
|
+
#
|
102
|
+
# @yield [config] Configure the Client client.
|
103
|
+
# @yieldparam config [Client::Configuration]
|
104
|
+
#
|
105
|
+
# @return [Client::Configuration]
|
106
|
+
#
|
107
|
+
def configure
|
108
|
+
yield @config if block_given?
|
109
|
+
@config
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Create a new TraceService REST client object.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
#
|
117
|
+
# # Create a client using the default configuration
|
118
|
+
# client = ::Google::Cloud::Trace::V1::TraceService::Rest::Client.new
|
119
|
+
#
|
120
|
+
# # Create a client using a custom configuration
|
121
|
+
# client = ::Google::Cloud::Trace::V1::TraceService::Rest::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
|
+
# Create the configuration object
|
130
|
+
@config = Configuration.new Client.configure
|
131
|
+
|
132
|
+
# Yield the configuration if needed
|
133
|
+
yield @config if block_given?
|
134
|
+
|
135
|
+
# Create credentials
|
136
|
+
credentials = @config.credentials
|
137
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
138
|
+
# but only if the default endpoint does not have a region prefix.
|
139
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
140
|
+
!@config.endpoint.split(".").first.include?("-")
|
141
|
+
credentials ||= Credentials.default scope: @config.scope,
|
142
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
143
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
144
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
145
|
+
end
|
146
|
+
|
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 = ::Google::Cloud::Trace::V1::TraceService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
151
|
+
end
|
152
|
+
|
153
|
+
# Service calls
|
154
|
+
|
155
|
+
##
|
156
|
+
# Returns of a list of traces that match the specified filter conditions.
|
157
|
+
#
|
158
|
+
# @overload list_traces(request, options = nil)
|
159
|
+
# Pass arguments to `list_traces` via a request object, either of type
|
160
|
+
# {::Google::Cloud::Trace::V1::ListTracesRequest} or an equivalent Hash.
|
161
|
+
#
|
162
|
+
# @param request [::Google::Cloud::Trace::V1::ListTracesRequest, ::Hash]
|
163
|
+
# A request object representing the call parameters. Required. To specify no
|
164
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
165
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
166
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
167
|
+
#
|
168
|
+
# @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)
|
169
|
+
# Pass arguments to `list_traces` via keyword arguments. Note that at
|
170
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
171
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
172
|
+
#
|
173
|
+
# @param project_id [::String]
|
174
|
+
# Required. ID of the Cloud project where the trace data is stored.
|
175
|
+
# @param view [::Google::Cloud::Trace::V1::ListTracesRequest::ViewType]
|
176
|
+
# Optional. Type of data returned for traces in the list. Default is
|
177
|
+
# `MINIMAL`.
|
178
|
+
# @param page_size [::Integer]
|
179
|
+
# Optional. Maximum number of traces to return. If not specified or <= 0, the
|
180
|
+
# implementation selects a reasonable value. The implementation may
|
181
|
+
# return fewer traces than the requested page size.
|
182
|
+
# @param page_token [::String]
|
183
|
+
# Token identifying the page of results to return. If provided, use the
|
184
|
+
# value of the `next_page_token` field from a previous request.
|
185
|
+
# @param start_time [::Google::Protobuf::Timestamp, ::Hash]
|
186
|
+
# Start of the time interval (inclusive) during which the trace data was
|
187
|
+
# collected from the application.
|
188
|
+
# @param end_time [::Google::Protobuf::Timestamp, ::Hash]
|
189
|
+
# End of the time interval (inclusive) during which the trace data was
|
190
|
+
# collected from the application.
|
191
|
+
# @param filter [::String]
|
192
|
+
# Optional. A filter against labels for the request.
|
193
|
+
#
|
194
|
+
# By default, searches use prefix matching. To specify exact match, prepend
|
195
|
+
# a plus symbol (`+`) to the search term.
|
196
|
+
# Multiple terms are ANDed. Syntax:
|
197
|
+
#
|
198
|
+
# * `root:NAME_PREFIX` or `NAME_PREFIX`: Return traces where any root
|
199
|
+
# span starts with `NAME_PREFIX`.
|
200
|
+
# * `+root:NAME` or `+NAME`: Return traces where any root span's name is
|
201
|
+
# exactly `NAME`.
|
202
|
+
# * `span:NAME_PREFIX`: Return traces where any span starts with
|
203
|
+
# `NAME_PREFIX`.
|
204
|
+
# * `+span:NAME`: Return traces where any span's name is exactly
|
205
|
+
# `NAME`.
|
206
|
+
# * `latency:DURATION`: Return traces whose overall latency is
|
207
|
+
# greater or equal to than `DURATION`. Accepted units are nanoseconds
|
208
|
+
# (`ns`), milliseconds (`ms`), and seconds (`s`). Default is `ms`. For
|
209
|
+
# example, `latency:24ms` returns traces whose overall latency
|
210
|
+
# is greater than or equal to 24 milliseconds.
|
211
|
+
# * `label:LABEL_KEY`: Return all traces containing the specified
|
212
|
+
# label key (exact match, case-sensitive) regardless of the key:value
|
213
|
+
# pair's value (including empty values).
|
214
|
+
# * `LABEL_KEY:VALUE_PREFIX`: Return all traces containing the specified
|
215
|
+
# label key (exact match, case-sensitive) whose value starts with
|
216
|
+
# `VALUE_PREFIX`. Both a key and a value must be specified.
|
217
|
+
# * `+LABEL_KEY:VALUE`: Return all traces containing a key:value pair
|
218
|
+
# exactly matching the specified text. Both a key and a value must be
|
219
|
+
# specified.
|
220
|
+
# * `method:VALUE`: Equivalent to `/http/method:VALUE`.
|
221
|
+
# * `url:VALUE`: Equivalent to `/http/url:VALUE`.
|
222
|
+
# @param order_by [::String]
|
223
|
+
# Optional. Field used to sort the returned traces.
|
224
|
+
# Can be one of the following:
|
225
|
+
#
|
226
|
+
# * `trace_id`
|
227
|
+
# * `name` (`name` field of root span in the trace)
|
228
|
+
# * `duration` (difference between `end_time` and `start_time` fields of
|
229
|
+
# the root span)
|
230
|
+
# * `start` (`start_time` field of the root span)
|
231
|
+
#
|
232
|
+
# Descending order can be specified by appending `desc` to the sort field
|
233
|
+
# (for example, `name desc`).
|
234
|
+
#
|
235
|
+
# Only one sort field is permitted.
|
236
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
237
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Trace::V1::Trace>]
|
238
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
239
|
+
#
|
240
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Trace::V1::Trace>]
|
241
|
+
#
|
242
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
243
|
+
def list_traces request, options = nil
|
244
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
245
|
+
|
246
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Trace::V1::ListTracesRequest
|
247
|
+
|
248
|
+
# Converts hash and nil to an options object
|
249
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
250
|
+
|
251
|
+
# Customize the options with defaults
|
252
|
+
call_metadata = @config.rpcs.list_traces.metadata.to_h
|
253
|
+
|
254
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
255
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
256
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
257
|
+
gapic_version: ::Google::Cloud::Trace::V1::VERSION,
|
258
|
+
transports_version_send: [:rest]
|
259
|
+
|
260
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
261
|
+
|
262
|
+
options.apply_defaults timeout: @config.rpcs.list_traces.timeout,
|
263
|
+
metadata: call_metadata,
|
264
|
+
retry_policy: @config.rpcs.list_traces.retry_policy
|
265
|
+
|
266
|
+
options.apply_defaults timeout: @config.timeout,
|
267
|
+
metadata: @config.metadata,
|
268
|
+
retry_policy: @config.retry_policy
|
269
|
+
|
270
|
+
@trace_service_stub.list_traces request, options do |result, operation|
|
271
|
+
result = ::Gapic::Rest::PagedEnumerable.new @trace_service_stub, :list_traces, "traces", request, result, options
|
272
|
+
yield result, operation if block_given?
|
273
|
+
return result
|
274
|
+
end
|
275
|
+
rescue ::Gapic::Rest::Error => e
|
276
|
+
raise ::Google::Cloud::Error.from_error(e)
|
277
|
+
end
|
278
|
+
|
279
|
+
##
|
280
|
+
# Gets a single trace by its ID.
|
281
|
+
#
|
282
|
+
# @overload get_trace(request, options = nil)
|
283
|
+
# Pass arguments to `get_trace` via a request object, either of type
|
284
|
+
# {::Google::Cloud::Trace::V1::GetTraceRequest} or an equivalent Hash.
|
285
|
+
#
|
286
|
+
# @param request [::Google::Cloud::Trace::V1::GetTraceRequest, ::Hash]
|
287
|
+
# A request object representing the call parameters. Required. To specify no
|
288
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
289
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
290
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
291
|
+
#
|
292
|
+
# @overload get_trace(project_id: nil, trace_id: nil)
|
293
|
+
# Pass arguments to `get_trace` via keyword arguments. Note that at
|
294
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
295
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
296
|
+
#
|
297
|
+
# @param project_id [::String]
|
298
|
+
# Required. ID of the Cloud project where the trace data is stored.
|
299
|
+
# @param trace_id [::String]
|
300
|
+
# Required. ID of the trace to return.
|
301
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
302
|
+
# @yieldparam result [::Google::Cloud::Trace::V1::Trace]
|
303
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
304
|
+
#
|
305
|
+
# @return [::Google::Cloud::Trace::V1::Trace]
|
306
|
+
#
|
307
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
308
|
+
def get_trace request, options = nil
|
309
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
310
|
+
|
311
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Trace::V1::GetTraceRequest
|
312
|
+
|
313
|
+
# Converts hash and nil to an options object
|
314
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
315
|
+
|
316
|
+
# Customize the options with defaults
|
317
|
+
call_metadata = @config.rpcs.get_trace.metadata.to_h
|
318
|
+
|
319
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
320
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
321
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
322
|
+
gapic_version: ::Google::Cloud::Trace::V1::VERSION,
|
323
|
+
transports_version_send: [:rest]
|
324
|
+
|
325
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
326
|
+
|
327
|
+
options.apply_defaults timeout: @config.rpcs.get_trace.timeout,
|
328
|
+
metadata: call_metadata,
|
329
|
+
retry_policy: @config.rpcs.get_trace.retry_policy
|
330
|
+
|
331
|
+
options.apply_defaults timeout: @config.timeout,
|
332
|
+
metadata: @config.metadata,
|
333
|
+
retry_policy: @config.retry_policy
|
334
|
+
|
335
|
+
@trace_service_stub.get_trace request, options do |result, operation|
|
336
|
+
yield result, operation if block_given?
|
337
|
+
return result
|
338
|
+
end
|
339
|
+
rescue ::Gapic::Rest::Error => e
|
340
|
+
raise ::Google::Cloud::Error.from_error(e)
|
341
|
+
end
|
342
|
+
|
343
|
+
##
|
344
|
+
# Sends new traces to Stackdriver Trace or updates existing traces. If the ID
|
345
|
+
# of a trace that you send matches that of an existing trace, any fields
|
346
|
+
# in the existing trace and its spans are overwritten by the provided values,
|
347
|
+
# and any new fields provided are merged with the existing trace data. If the
|
348
|
+
# ID does not match, a new trace is created.
|
349
|
+
#
|
350
|
+
# @overload patch_traces(request, options = nil)
|
351
|
+
# Pass arguments to `patch_traces` via a request object, either of type
|
352
|
+
# {::Google::Cloud::Trace::V1::PatchTracesRequest} or an equivalent Hash.
|
353
|
+
#
|
354
|
+
# @param request [::Google::Cloud::Trace::V1::PatchTracesRequest, ::Hash]
|
355
|
+
# A request object representing the call parameters. Required. To specify no
|
356
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
357
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
358
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
359
|
+
#
|
360
|
+
# @overload patch_traces(project_id: nil, traces: nil)
|
361
|
+
# Pass arguments to `patch_traces` via keyword arguments. Note that at
|
362
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
363
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
364
|
+
#
|
365
|
+
# @param project_id [::String]
|
366
|
+
# Required. ID of the Cloud project where the trace data is stored.
|
367
|
+
# @param traces [::Google::Cloud::Trace::V1::Traces, ::Hash]
|
368
|
+
# Required. The body of the message.
|
369
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
370
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
371
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
372
|
+
#
|
373
|
+
# @return [::Google::Protobuf::Empty]
|
374
|
+
#
|
375
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
376
|
+
def patch_traces request, options = nil
|
377
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
378
|
+
|
379
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Trace::V1::PatchTracesRequest
|
380
|
+
|
381
|
+
# Converts hash and nil to an options object
|
382
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
383
|
+
|
384
|
+
# Customize the options with defaults
|
385
|
+
call_metadata = @config.rpcs.patch_traces.metadata.to_h
|
386
|
+
|
387
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
388
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
389
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
390
|
+
gapic_version: ::Google::Cloud::Trace::V1::VERSION,
|
391
|
+
transports_version_send: [:rest]
|
392
|
+
|
393
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
394
|
+
|
395
|
+
options.apply_defaults timeout: @config.rpcs.patch_traces.timeout,
|
396
|
+
metadata: call_metadata,
|
397
|
+
retry_policy: @config.rpcs.patch_traces.retry_policy
|
398
|
+
|
399
|
+
options.apply_defaults timeout: @config.timeout,
|
400
|
+
metadata: @config.metadata,
|
401
|
+
retry_policy: @config.retry_policy
|
402
|
+
|
403
|
+
@trace_service_stub.patch_traces request, options do |result, operation|
|
404
|
+
yield result, operation if block_given?
|
405
|
+
return result
|
406
|
+
end
|
407
|
+
rescue ::Gapic::Rest::Error => e
|
408
|
+
raise ::Google::Cloud::Error.from_error(e)
|
409
|
+
end
|
410
|
+
|
411
|
+
##
|
412
|
+
# Configuration class for the TraceService REST API.
|
413
|
+
#
|
414
|
+
# This class represents the configuration for TraceService REST,
|
415
|
+
# providing control over timeouts, retry behavior, logging, transport
|
416
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
417
|
+
# applied individually to specific RPCs. See
|
418
|
+
# {::Google::Cloud::Trace::V1::TraceService::Rest::Client::Configuration::Rpcs}
|
419
|
+
# for a list of RPCs that can be configured independently.
|
420
|
+
#
|
421
|
+
# Configuration can be applied globally to all clients, or to a single client
|
422
|
+
# on construction.
|
423
|
+
#
|
424
|
+
# @example
|
425
|
+
#
|
426
|
+
# # Modify the global config, setting the timeout for
|
427
|
+
# # list_traces to 20 seconds,
|
428
|
+
# # and all remaining timeouts to 10 seconds.
|
429
|
+
# ::Google::Cloud::Trace::V1::TraceService::Rest::Client.configure do |config|
|
430
|
+
# config.timeout = 10.0
|
431
|
+
# config.rpcs.list_traces.timeout = 20.0
|
432
|
+
# end
|
433
|
+
#
|
434
|
+
# # Apply the above configuration only to a new client.
|
435
|
+
# client = ::Google::Cloud::Trace::V1::TraceService::Rest::Client.new do |config|
|
436
|
+
# config.timeout = 10.0
|
437
|
+
# config.rpcs.list_traces.timeout = 20.0
|
438
|
+
# end
|
439
|
+
#
|
440
|
+
# @!attribute [rw] endpoint
|
441
|
+
# The hostname or hostname:port of the service endpoint.
|
442
|
+
# Defaults to `"cloudtrace.googleapis.com"`.
|
443
|
+
# @return [::String]
|
444
|
+
# @!attribute [rw] credentials
|
445
|
+
# Credentials to send with calls. You may provide any of the following types:
|
446
|
+
# * (`String`) The path to a service account key file in JSON format
|
447
|
+
# * (`Hash`) A service account key as a Hash
|
448
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
449
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
450
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
451
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
452
|
+
# * (`nil`) indicating no credentials
|
453
|
+
# @return [::Object]
|
454
|
+
# @!attribute [rw] scope
|
455
|
+
# The OAuth scopes
|
456
|
+
# @return [::Array<::String>]
|
457
|
+
# @!attribute [rw] lib_name
|
458
|
+
# The library name as recorded in instrumentation and logging
|
459
|
+
# @return [::String]
|
460
|
+
# @!attribute [rw] lib_version
|
461
|
+
# The library version as recorded in instrumentation and logging
|
462
|
+
# @return [::String]
|
463
|
+
# @!attribute [rw] timeout
|
464
|
+
# The call timeout in seconds.
|
465
|
+
# @return [::Numeric]
|
466
|
+
# @!attribute [rw] metadata
|
467
|
+
# Additional headers to be sent with the call.
|
468
|
+
# @return [::Hash{::Symbol=>::String}]
|
469
|
+
# @!attribute [rw] retry_policy
|
470
|
+
# The retry policy. The value is a hash with the following keys:
|
471
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
472
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
473
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
474
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
475
|
+
# trigger a retry.
|
476
|
+
# @return [::Hash]
|
477
|
+
# @!attribute [rw] quota_project
|
478
|
+
# A separate project against which to charge quota.
|
479
|
+
# @return [::String]
|
480
|
+
#
|
481
|
+
class Configuration
|
482
|
+
extend ::Gapic::Config
|
483
|
+
|
484
|
+
config_attr :endpoint, "cloudtrace.googleapis.com", ::String
|
485
|
+
config_attr :credentials, nil do |value|
|
486
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
487
|
+
allowed.any? { |klass| klass === value }
|
488
|
+
end
|
489
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
490
|
+
config_attr :lib_name, nil, ::String, nil
|
491
|
+
config_attr :lib_version, nil, ::String, nil
|
492
|
+
config_attr :timeout, nil, ::Numeric, nil
|
493
|
+
config_attr :metadata, nil, ::Hash, nil
|
494
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
495
|
+
config_attr :quota_project, nil, ::String, nil
|
496
|
+
|
497
|
+
# @private
|
498
|
+
def initialize parent_config = nil
|
499
|
+
@parent_config = parent_config unless parent_config.nil?
|
500
|
+
|
501
|
+
yield self if block_given?
|
502
|
+
end
|
503
|
+
|
504
|
+
##
|
505
|
+
# Configurations for individual RPCs
|
506
|
+
# @return [Rpcs]
|
507
|
+
#
|
508
|
+
def rpcs
|
509
|
+
@rpcs ||= begin
|
510
|
+
parent_rpcs = nil
|
511
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
512
|
+
Rpcs.new parent_rpcs
|
513
|
+
end
|
514
|
+
end
|
515
|
+
|
516
|
+
##
|
517
|
+
# Configuration RPC class for the TraceService API.
|
518
|
+
#
|
519
|
+
# Includes fields providing the configuration for each RPC in this service.
|
520
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
521
|
+
# the following configuration fields:
|
522
|
+
#
|
523
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
524
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
525
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
526
|
+
# include the following keys:
|
527
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
528
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
529
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
530
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
531
|
+
# trigger a retry.
|
532
|
+
#
|
533
|
+
class Rpcs
|
534
|
+
##
|
535
|
+
# RPC-specific configuration for `list_traces`
|
536
|
+
# @return [::Gapic::Config::Method]
|
537
|
+
#
|
538
|
+
attr_reader :list_traces
|
539
|
+
##
|
540
|
+
# RPC-specific configuration for `get_trace`
|
541
|
+
# @return [::Gapic::Config::Method]
|
542
|
+
#
|
543
|
+
attr_reader :get_trace
|
544
|
+
##
|
545
|
+
# RPC-specific configuration for `patch_traces`
|
546
|
+
# @return [::Gapic::Config::Method]
|
547
|
+
#
|
548
|
+
attr_reader :patch_traces
|
549
|
+
|
550
|
+
# @private
|
551
|
+
def initialize parent_rpcs = nil
|
552
|
+
list_traces_config = parent_rpcs.list_traces if parent_rpcs.respond_to? :list_traces
|
553
|
+
@list_traces = ::Gapic::Config::Method.new list_traces_config
|
554
|
+
get_trace_config = parent_rpcs.get_trace if parent_rpcs.respond_to? :get_trace
|
555
|
+
@get_trace = ::Gapic::Config::Method.new get_trace_config
|
556
|
+
patch_traces_config = parent_rpcs.patch_traces if parent_rpcs.respond_to? :patch_traces
|
557
|
+
@patch_traces = ::Gapic::Config::Method.new patch_traces_config
|
558
|
+
|
559
|
+
yield self if block_given?
|
560
|
+
end
|
561
|
+
end
|
562
|
+
end
|
563
|
+
end
|
564
|
+
end
|
565
|
+
end
|
566
|
+
end
|
567
|
+
end
|
568
|
+
end
|
569
|
+
end
|