google-cloud-trace 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+ # Copyright 2014 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Cloud
18
+ module Trace
19
+ ##
20
+ # Utils provides some internal utility methods for Trace.
21
+ #
22
+ # @private
23
+ #
24
+ module Utils
25
+ ##
26
+ # Convert a Ruby Time object to a timestamp proto object.
27
+ #
28
+ # @private
29
+ #
30
+ def self.time_to_grpc time
31
+ Google::Protobuf::Timestamp.new seconds: time.to_i,
32
+ nanos: time.nsec
33
+ end
34
+
35
+ ##
36
+ # Convert a Timestamp proto object to a Ruby Time object.
37
+ #
38
+ # @private
39
+ #
40
+ def self.grpc_to_time grpc
41
+ Time.at(grpc.seconds, Rational(grpc.nanos, 1000)).utc
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,16 @@
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ require "google/cloud/trace/v1/trace_service_api"
@@ -0,0 +1,187 @@
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Devtools
17
+ module Cloudtrace
18
+ module V1
19
+ # A trace describes how long it takes for an application to perform an
20
+ # operation. It consists of a set of spans, each of which represent a single
21
+ # timed event within the operation.
22
+ # @!attribute [rw] project_id
23
+ # @return [String]
24
+ # Project ID of the Cloud project where the trace data is stored.
25
+ # @!attribute [rw] trace_id
26
+ # @return [String]
27
+ # Globally unique identifier for the trace. This identifier is a 128-bit
28
+ # numeric value formatted as a 32-byte hex string.
29
+ # @!attribute [rw] spans
30
+ # @return [Array<Google::Devtools::Cloudtrace::V1::TraceSpan>]
31
+ # Collection of spans in the trace.
32
+ class Trace; end
33
+
34
+ # List of new or updated traces.
35
+ # @!attribute [rw] traces
36
+ # @return [Array<Google::Devtools::Cloudtrace::V1::Trace>]
37
+ # List of traces.
38
+ class Traces; end
39
+
40
+ # A span represents a single timed event within a trace. Spans can be nested
41
+ # and form a trace tree. Often, a trace contains a root span that describes the
42
+ # end-to-end latency of an operation and, optionally, one or more subspans for
43
+ # its suboperations. Spans do not need to be contiguous. There may be gaps
44
+ # between spans in a trace.
45
+ # @!attribute [rw] span_id
46
+ # @return [Integer]
47
+ # Identifier for the span. Must be a 64-bit integer other than 0 and
48
+ # unique within a trace.
49
+ # @!attribute [rw] kind
50
+ # @return [Google::Devtools::Cloudtrace::V1::TraceSpan::SpanKind]
51
+ # Distinguishes between spans generated in a particular context. For example,
52
+ # two spans with the same name may be distinguished using +RPC_CLIENT+
53
+ # and +RPC_SERVER+ to identify queueing latency associated with the span.
54
+ # @!attribute [rw] name
55
+ # @return [String]
56
+ # Name of the trace. The trace name is sanitized and displayed in the
57
+ # Stackdriver Trace tool in the Google Developers Console.
58
+ # The name may be a method name or some other per-call site name.
59
+ # For the same executable and the same call point, a best practice is
60
+ # to use a consistent name, which makes it easier to correlate
61
+ # cross-trace spans.
62
+ # @!attribute [rw] start_time
63
+ # @return [Google::Protobuf::Timestamp]
64
+ # Start time of the span in nanoseconds from the UNIX epoch.
65
+ # @!attribute [rw] end_time
66
+ # @return [Google::Protobuf::Timestamp]
67
+ # End time of the span in nanoseconds from the UNIX epoch.
68
+ # @!attribute [rw] parent_span_id
69
+ # @return [Integer]
70
+ # ID of the parent span, if any. Optional.
71
+ # @!attribute [rw] labels
72
+ # @return [Hash{String => String}]
73
+ # Collection of labels associated with the span.
74
+ class TraceSpan
75
+ # Type of span. Can be used to specify additional relationships between spans
76
+ # in addition to a parent/child relationship.
77
+ module SpanKind
78
+ # Unspecified.
79
+ SPAN_KIND_UNSPECIFIED = 0
80
+
81
+ # Indicates that the span covers server-side handling of an RPC or other
82
+ # remote network request.
83
+ RPC_SERVER = 1
84
+
85
+ # Indicates that the span covers the client-side wrapper around an RPC or
86
+ # other remote request.
87
+ RPC_CLIENT = 2
88
+ end
89
+ end
90
+
91
+ # The request message for the +ListTraces+ method. All fields are required
92
+ # unless specified.
93
+ # @!attribute [rw] project_id
94
+ # @return [String]
95
+ # ID of the Cloud project where the trace data is stored.
96
+ # @!attribute [rw] view
97
+ # @return [Google::Devtools::Cloudtrace::V1::ListTracesRequest::ViewType]
98
+ # Type of data returned for traces in the list. Optional. Default is
99
+ # +MINIMAL+.
100
+ # @!attribute [rw] page_size
101
+ # @return [Integer]
102
+ # Maximum number of traces to return. If not specified or <= 0, the
103
+ # implementation selects a reasonable value. The implementation may
104
+ # return fewer traces than the requested page size. Optional.
105
+ # @!attribute [rw] page_token
106
+ # @return [String]
107
+ # Token identifying the page of results to return. If provided, use the
108
+ # value of the +next_page_token+ field from a previous request. Optional.
109
+ # @!attribute [rw] start_time
110
+ # @return [Google::Protobuf::Timestamp]
111
+ # End of the time interval (inclusive) during which the trace data was
112
+ # collected from the application.
113
+ # @!attribute [rw] end_time
114
+ # @return [Google::Protobuf::Timestamp]
115
+ # Start of the time interval (inclusive) during which the trace data was
116
+ # collected from the application.
117
+ # @!attribute [rw] filter
118
+ # @return [String]
119
+ # An optional filter for the request.
120
+ # @!attribute [rw] order_by
121
+ # @return [String]
122
+ # Field used to sort the returned traces. Optional.
123
+ # Can be one of the following:
124
+ #
125
+ # * +trace_id+
126
+ # * +name+ (+name+ field of root span in the trace)
127
+ # * +duration+ (difference between +end_time+ and +start_time+ fields of
128
+ # the root span)
129
+ # * +start+ (+start_time+ field of the root span)
130
+ #
131
+ # Descending order can be specified by appending +desc+ to the sort field
132
+ # (for example, +name desc+).
133
+ #
134
+ # Only one sort field is permitted.
135
+ class ListTracesRequest
136
+ # Type of data returned for traces in the list.
137
+ module ViewType
138
+ # Default is +MINIMAL+ if unspecified.
139
+ VIEW_TYPE_UNSPECIFIED = 0
140
+
141
+ # Minimal view of the trace record that contains only the project
142
+ # and trace IDs.
143
+ MINIMAL = 1
144
+
145
+ # Root span view of the trace record that returns the root spans along
146
+ # with the minimal trace data.
147
+ ROOTSPAN = 2
148
+
149
+ # Complete view of the trace record that contains the actual trace data.
150
+ # This is equivalent to calling the REST +get+ or RPC +GetTrace+ method
151
+ # using the ID of each listed trace.
152
+ COMPLETE = 3
153
+ end
154
+ end
155
+
156
+ # The response message for the +ListTraces+ method.
157
+ # @!attribute [rw] traces
158
+ # @return [Array<Google::Devtools::Cloudtrace::V1::Trace>]
159
+ # List of trace records returned.
160
+ # @!attribute [rw] next_page_token
161
+ # @return [String]
162
+ # If defined, indicates that there are more traces that match the request
163
+ # and that this value should be passed to the next request to continue
164
+ # retrieving additional traces.
165
+ class ListTracesResponse; end
166
+
167
+ # The request message for the +GetTrace+ method.
168
+ # @!attribute [rw] project_id
169
+ # @return [String]
170
+ # ID of the Cloud project where the trace data is stored.
171
+ # @!attribute [rw] trace_id
172
+ # @return [String]
173
+ # ID of the trace to return.
174
+ class GetTraceRequest; end
175
+
176
+ # The request message for the +PatchTraces+ method.
177
+ # @!attribute [rw] project_id
178
+ # @return [String]
179
+ # ID of the Cloud project where the trace data is stored.
180
+ # @!attribute [rw] traces
181
+ # @return [Google::Devtools::Cloudtrace::V1::Traces]
182
+ # The body of the message.
183
+ class PatchTracesRequest; end
184
+ end
185
+ end
186
+ end
187
+ end
@@ -0,0 +1,83 @@
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Protobuf
17
+ # A Timestamp represents a point in time independent of any time zone
18
+ # or calendar, represented as seconds and fractions of seconds at
19
+ # nanosecond resolution in UTC Epoch time. It is encoded using the
20
+ # Proleptic Gregorian Calendar which extends the Gregorian calendar
21
+ # backwards to year one. It is encoded assuming all minutes are 60
22
+ # seconds long, i.e. leap seconds are "smeared" so that no leap second
23
+ # table is needed for interpretation. Range is from
24
+ # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
25
+ # By restricting to that range, we ensure that we can convert to
26
+ # and from RFC 3339 date strings.
27
+ # See {https://www.ietf.org/rfc/rfc3339.txt}[https://www.ietf.org/rfc/rfc3339.txt].
28
+ #
29
+ # Example 1: Compute Timestamp from POSIX +time()+.
30
+ #
31
+ # Timestamp timestamp;
32
+ # timestamp.set_seconds(time(NULL));
33
+ # timestamp.set_nanos(0);
34
+ #
35
+ # Example 2: Compute Timestamp from POSIX +gettimeofday()+.
36
+ #
37
+ # struct timeval tv;
38
+ # gettimeofday(&tv, NULL);
39
+ #
40
+ # Timestamp timestamp;
41
+ # timestamp.set_seconds(tv.tv_sec);
42
+ # timestamp.set_nanos(tv.tv_usec * 1000);
43
+ #
44
+ # Example 3: Compute Timestamp from Win32 +GetSystemTimeAsFileTime()+.
45
+ #
46
+ # FILETIME ft;
47
+ # GetSystemTimeAsFileTime(&ft);
48
+ # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
49
+ #
50
+ # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
51
+ # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
52
+ # Timestamp timestamp;
53
+ # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
54
+ # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
55
+ #
56
+ # Example 4: Compute Timestamp from Java +System.currentTimeMillis()+.
57
+ #
58
+ # long millis = System.currentTimeMillis();
59
+ #
60
+ # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
61
+ # .setNanos((int) ((millis % 1000) * 1000000)).build();
62
+ #
63
+ #
64
+ # Example 5: Compute Timestamp from current time in Python.
65
+ #
66
+ # now = time.time()
67
+ # seconds = int(now)
68
+ # nanos = int((now - seconds) * 10**9)
69
+ # timestamp = Timestamp(seconds=seconds, nanos=nanos)
70
+ # @!attribute [rw] seconds
71
+ # @return [Integer]
72
+ # Represents seconds of UTC time since Unix epoch
73
+ # 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
74
+ # 9999-12-31T23:59:59Z inclusive.
75
+ # @!attribute [rw] nanos
76
+ # @return [Integer]
77
+ # Non-negative fractions of a second at nanosecond resolution. Negative
78
+ # second values with fractions must still have non-negative nanos values
79
+ # that count forward in time. Must be from 0 to 999,999,999
80
+ # inclusive.
81
+ class Timestamp; end
82
+ end
83
+ end
@@ -0,0 +1,307 @@
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/devtools/cloudtrace/v1/trace.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+ #
22
+ # The only allowed edits are to method and file documentation. A 3-way
23
+ # merge preserves those additions if the generated source changes.
24
+
25
+ require "json"
26
+ require "pathname"
27
+
28
+ require "google/gax"
29
+ require "google/devtools/cloudtrace/v1/trace_pb"
30
+
31
+ module Google
32
+ module Cloud
33
+ module Trace
34
+ module V1
35
+ # This file describes an API for collecting and viewing traces and spans
36
+ # within a trace. A Trace is a collection of spans corresponding to a single
37
+ # operation or set of operations for an application. A span is an individual
38
+ # timed event which forms a node of the trace tree. Spans for a single trace
39
+ # may span multiple services.
40
+ #
41
+ # @!attribute [r] trace_service_stub
42
+ # @return [Google::Devtools::Cloudtrace::V1::TraceService::Stub]
43
+ class TraceServiceApi
44
+ attr_reader :trace_service_stub
45
+
46
+ # The default address of the service.
47
+ SERVICE_ADDRESS = "cloudtrace.googleapis.com".freeze
48
+
49
+ # The default port of the service.
50
+ DEFAULT_SERVICE_PORT = 443
51
+
52
+ CODE_GEN_NAME_VERSION = "gapic/0.1.0".freeze
53
+
54
+ DEFAULT_TIMEOUT = 30
55
+
56
+ PAGE_DESCRIPTORS = {
57
+ "list_traces" => Google::Gax::PageDescriptor.new(
58
+ "page_token",
59
+ "next_page_token",
60
+ "traces")
61
+ }.freeze
62
+
63
+ private_constant :PAGE_DESCRIPTORS
64
+
65
+ # The scopes needed to make gRPC calls to all of the methods defined in
66
+ # this service.
67
+ ALL_SCOPES = [
68
+ "https://www.googleapis.com/auth/cloud-platform",
69
+ "https://www.googleapis.com/auth/trace.append",
70
+ "https://www.googleapis.com/auth/trace.readonly"
71
+ ].freeze
72
+
73
+ # @param service_path [String]
74
+ # The domain name of the API remote host.
75
+ # @param port [Integer]
76
+ # The port on which to connect to the remote host.
77
+ # @param channel [Channel]
78
+ # A Channel object through which to make calls.
79
+ # @param chan_creds [Grpc::ChannelCredentials]
80
+ # A ChannelCredentials for the setting up the RPC client.
81
+ # @param client_config[Hash]
82
+ # A Hash for call options for each method. See
83
+ # Google::Gax#construct_settings for the structure of
84
+ # this data. Falls back to the default config if not specified
85
+ # or the specified config is missing data points.
86
+ # @param timeout [Numeric]
87
+ # The default timeout, in seconds, for calls made through this client.
88
+ # @param app_name [String]
89
+ # The codename of the calling service.
90
+ # @param app_version [String]
91
+ # The version of the calling service.
92
+ def initialize \
93
+ service_path: SERVICE_ADDRESS,
94
+ port: DEFAULT_SERVICE_PORT,
95
+ channel: nil,
96
+ chan_creds: nil,
97
+ scopes: ALL_SCOPES,
98
+ client_config: {},
99
+ timeout: DEFAULT_TIMEOUT,
100
+ app_name: "gax",
101
+ app_version: Google::Gax::VERSION
102
+ # These require statements are intentionally placed here to initialize
103
+ # the gRPC module only when it's required.
104
+ # See https://github.com/googleapis/toolkit/issues/446
105
+ require "google/gax/grpc"
106
+ require "google/devtools/cloudtrace/v1/trace_services_pb"
107
+
108
+ google_api_client = "#{app_name}/#{app_version} " \
109
+ "#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
110
+ "ruby/#{RUBY_VERSION}".freeze
111
+ headers = { :"x-goog-api-client" => google_api_client }
112
+ client_config_file = Pathname.new(__dir__).join(
113
+ "trace_service_client_config.json"
114
+ )
115
+ defaults = client_config_file.open do |f|
116
+ Google::Gax.construct_settings(
117
+ "google.devtools.cloudtrace.v1.TraceService",
118
+ JSON.parse(f.read),
119
+ client_config,
120
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
121
+ timeout,
122
+ page_descriptors: PAGE_DESCRIPTORS,
123
+ errors: Google::Gax::Grpc::API_ERRORS,
124
+ kwargs: headers
125
+ )
126
+ end
127
+ @trace_service_stub = Google::Gax::Grpc.create_stub(
128
+ service_path,
129
+ port,
130
+ chan_creds: chan_creds,
131
+ channel: channel,
132
+ scopes: scopes,
133
+ &Google::Devtools::Cloudtrace::V1::TraceService::Stub.method(:new)
134
+ )
135
+
136
+ @patch_traces = Google::Gax.create_api_call(
137
+ @trace_service_stub.method(:patch_traces),
138
+ defaults["patch_traces"]
139
+ )
140
+ @get_trace = Google::Gax.create_api_call(
141
+ @trace_service_stub.method(:get_trace),
142
+ defaults["get_trace"]
143
+ )
144
+ @list_traces = Google::Gax.create_api_call(
145
+ @trace_service_stub.method(:list_traces),
146
+ defaults["list_traces"]
147
+ )
148
+ end
149
+
150
+ # Service calls
151
+
152
+ # Sends new traces to Stackdriver Trace or updates existing traces. If the ID
153
+ # of a trace that you send matches that of an existing trace, any fields
154
+ # in the existing trace and its spans are overwritten by the provided values,
155
+ # and any new fields provided are merged with the existing trace data. If the
156
+ # ID does not match, a new trace is created.
157
+ #
158
+ # @param project_id [String]
159
+ # ID of the Cloud project where the trace data is stored.
160
+ # @param traces [Google::Devtools::Cloudtrace::V1::Traces]
161
+ # The body of the message.
162
+ # @param options [Google::Gax::CallOptions]
163
+ # Overrides the default settings for this call, e.g, timeout,
164
+ # retries, etc.
165
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
166
+ # @example
167
+ # require "google/cloud/trace/v1/trace_service_api"
168
+ #
169
+ # TraceServiceApi = Google::Cloud::Trace::V1::TraceServiceApi
170
+ # Traces = Google::Devtools::Cloudtrace::V1::Traces
171
+ #
172
+ # trace_service_api = TraceServiceApi.new
173
+ # project_id = ''
174
+ # traces = Traces.new
175
+ # trace_service_api.patch_traces(project_id, traces)
176
+
177
+ def patch_traces \
178
+ project_id,
179
+ traces,
180
+ options: nil
181
+ req = Google::Devtools::Cloudtrace::V1::PatchTracesRequest.new({
182
+ project_id: project_id,
183
+ traces: traces
184
+ }.delete_if { |_, v| v.nil? })
185
+ @patch_traces.call(req, options)
186
+ end
187
+
188
+ # Gets a single trace by its ID.
189
+ #
190
+ # @param project_id [String]
191
+ # ID of the Cloud project where the trace data is stored.
192
+ # @param trace_id [String]
193
+ # ID of the trace to return.
194
+ # @param options [Google::Gax::CallOptions]
195
+ # Overrides the default settings for this call, e.g, timeout,
196
+ # retries, etc.
197
+ # @return [Google::Devtools::Cloudtrace::V1::Trace]
198
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
199
+ # @example
200
+ # require "google/cloud/trace/v1/trace_service_api"
201
+ #
202
+ # TraceServiceApi = Google::Cloud::Trace::V1::TraceServiceApi
203
+ #
204
+ # trace_service_api = TraceServiceApi.new
205
+ # project_id = ''
206
+ # trace_id = ''
207
+ # response = trace_service_api.get_trace(project_id, trace_id)
208
+
209
+ def get_trace \
210
+ project_id,
211
+ trace_id,
212
+ options: nil
213
+ req = Google::Devtools::Cloudtrace::V1::GetTraceRequest.new({
214
+ project_id: project_id,
215
+ trace_id: trace_id
216
+ }.delete_if { |_, v| v.nil? })
217
+ @get_trace.call(req, options)
218
+ end
219
+
220
+ # Returns of a list of traces that match the specified filter conditions.
221
+ #
222
+ # @param project_id [String]
223
+ # ID of the Cloud project where the trace data is stored.
224
+ # @param view [Google::Devtools::Cloudtrace::V1::ListTracesRequest::ViewType]
225
+ # Type of data returned for traces in the list. Optional. Default is
226
+ # +MINIMAL+.
227
+ # @param page_size [Integer]
228
+ # Maximum number of traces to return. If not specified or <= 0, the
229
+ # implementation selects a reasonable value. The implementation may
230
+ # return fewer traces than the requested page size. Optional.
231
+ # @param start_time [Google::Protobuf::Timestamp]
232
+ # End of the time interval (inclusive) during which the trace data was
233
+ # collected from the application.
234
+ # @param end_time [Google::Protobuf::Timestamp]
235
+ # Start of the time interval (inclusive) during which the trace data was
236
+ # collected from the application.
237
+ # @param filter [String]
238
+ # An optional filter for the request.
239
+ # @param order_by [String]
240
+ # Field used to sort the returned traces. Optional.
241
+ # Can be one of the following:
242
+ #
243
+ # * +trace_id+
244
+ # * +name+ (+name+ field of root span in the trace)
245
+ # * +duration+ (difference between +end_time+ and +start_time+ fields of
246
+ # the root span)
247
+ # * +start+ (+start_time+ field of the root span)
248
+ #
249
+ # Descending order can be specified by appending +desc+ to the sort field
250
+ # (for example, +name desc+).
251
+ #
252
+ # Only one sort field is permitted.
253
+ # @param options [Google::Gax::CallOptions]
254
+ # Overrides the default settings for this call, e.g, timeout,
255
+ # retries, etc.
256
+ # @return [Google::Gax::PagedEnumerable<Google::Devtools::Cloudtrace::V1::Trace>]
257
+ # An enumerable of Google::Devtools::Cloudtrace::V1::Trace instances.
258
+ # See Google::Gax::PagedEnumerable documentation for other
259
+ # operations such as per-page iteration or access to the response
260
+ # object.
261
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
262
+ # @example
263
+ # require "google/cloud/trace/v1/trace_service_api"
264
+ #
265
+ # TraceServiceApi = Google::Cloud::Trace::V1::TraceServiceApi
266
+ #
267
+ # trace_service_api = TraceServiceApi.new
268
+ # project_id = ''
269
+ #
270
+ # # Iterate over all results.
271
+ # trace_service_api.list_traces(project_id).each do |element|
272
+ # # Process element.
273
+ # end
274
+ #
275
+ # # Or iterate over results one page at a time.
276
+ # trace_service_api.list_traces(project_id).each_page do |page|
277
+ # # Process each page at a time.
278
+ # page.each do |element|
279
+ # # Process element.
280
+ # end
281
+ # end
282
+
283
+ def list_traces \
284
+ project_id,
285
+ view: nil,
286
+ page_size: nil,
287
+ start_time: nil,
288
+ end_time: nil,
289
+ filter: nil,
290
+ order_by: nil,
291
+ options: nil
292
+ req = Google::Devtools::Cloudtrace::V1::ListTracesRequest.new({
293
+ project_id: project_id,
294
+ view: view,
295
+ page_size: page_size,
296
+ start_time: start_time,
297
+ end_time: end_time,
298
+ filter: filter,
299
+ order_by: order_by
300
+ }.delete_if { |_, v| v.nil? })
301
+ @list_traces.call(req, options)
302
+ end
303
+ end
304
+ end
305
+ end
306
+ end
307
+ end