google-apis-cloudtrace_v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
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 Apis
17
+ module CloudtraceV2
18
+ # Version of the google-apis-cloudtrace_v2 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20200805"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,311 @@
1
+ # Copyright 2020 Google LLC
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
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module CloudtraceV2
24
+
25
+ class Annotation
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class AttributeValue
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class Attributes
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class BatchWriteSpansRequest
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class Empty
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class Link
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class Links
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class MessageEvent
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class Module
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class Span
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class StackFrame
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class StackFrames
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class StackTrace
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class Status
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ include Google::Apis::Core::JsonObjectSupport
107
+ end
108
+
109
+ class TimeEvent
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+
112
+ include Google::Apis::Core::JsonObjectSupport
113
+ end
114
+
115
+ class TimeEvents
116
+ class Representation < Google::Apis::Core::JsonRepresentation; end
117
+
118
+ include Google::Apis::Core::JsonObjectSupport
119
+ end
120
+
121
+ class TruncatableString
122
+ class Representation < Google::Apis::Core::JsonRepresentation; end
123
+
124
+ include Google::Apis::Core::JsonObjectSupport
125
+ end
126
+
127
+ class Annotation
128
+ # @private
129
+ class Representation < Google::Apis::Core::JsonRepresentation
130
+ property :attributes, as: 'attributes', class: Google::Apis::CloudtraceV2::Attributes, decorator: Google::Apis::CloudtraceV2::Attributes::Representation
131
+
132
+ property :description, as: 'description', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
133
+
134
+ end
135
+ end
136
+
137
+ class AttributeValue
138
+ # @private
139
+ class Representation < Google::Apis::Core::JsonRepresentation
140
+ property :bool_value, as: 'boolValue'
141
+ property :int_value, :numeric_string => true, as: 'intValue'
142
+ property :string_value, as: 'stringValue', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
143
+
144
+ end
145
+ end
146
+
147
+ class Attributes
148
+ # @private
149
+ class Representation < Google::Apis::Core::JsonRepresentation
150
+ hash :attribute_map, as: 'attributeMap', class: Google::Apis::CloudtraceV2::AttributeValue, decorator: Google::Apis::CloudtraceV2::AttributeValue::Representation
151
+
152
+ property :dropped_attributes_count, as: 'droppedAttributesCount'
153
+ end
154
+ end
155
+
156
+ class BatchWriteSpansRequest
157
+ # @private
158
+ class Representation < Google::Apis::Core::JsonRepresentation
159
+ collection :spans, as: 'spans', class: Google::Apis::CloudtraceV2::Span, decorator: Google::Apis::CloudtraceV2::Span::Representation
160
+
161
+ end
162
+ end
163
+
164
+ class Empty
165
+ # @private
166
+ class Representation < Google::Apis::Core::JsonRepresentation
167
+ end
168
+ end
169
+
170
+ class Link
171
+ # @private
172
+ class Representation < Google::Apis::Core::JsonRepresentation
173
+ property :attributes, as: 'attributes', class: Google::Apis::CloudtraceV2::Attributes, decorator: Google::Apis::CloudtraceV2::Attributes::Representation
174
+
175
+ property :span_id, as: 'spanId'
176
+ property :trace_id, as: 'traceId'
177
+ property :type, as: 'type'
178
+ end
179
+ end
180
+
181
+ class Links
182
+ # @private
183
+ class Representation < Google::Apis::Core::JsonRepresentation
184
+ property :dropped_links_count, as: 'droppedLinksCount'
185
+ collection :link, as: 'link', class: Google::Apis::CloudtraceV2::Link, decorator: Google::Apis::CloudtraceV2::Link::Representation
186
+
187
+ end
188
+ end
189
+
190
+ class MessageEvent
191
+ # @private
192
+ class Representation < Google::Apis::Core::JsonRepresentation
193
+ property :compressed_size_bytes, :numeric_string => true, as: 'compressedSizeBytes'
194
+ property :id, :numeric_string => true, as: 'id'
195
+ property :type, as: 'type'
196
+ property :uncompressed_size_bytes, :numeric_string => true, as: 'uncompressedSizeBytes'
197
+ end
198
+ end
199
+
200
+ class Module
201
+ # @private
202
+ class Representation < Google::Apis::Core::JsonRepresentation
203
+ property :build_id, as: 'buildId', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
204
+
205
+ property :module, as: 'module', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
206
+
207
+ end
208
+ end
209
+
210
+ class Span
211
+ # @private
212
+ class Representation < Google::Apis::Core::JsonRepresentation
213
+ property :attributes, as: 'attributes', class: Google::Apis::CloudtraceV2::Attributes, decorator: Google::Apis::CloudtraceV2::Attributes::Representation
214
+
215
+ property :child_span_count, as: 'childSpanCount'
216
+ property :display_name, as: 'displayName', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
217
+
218
+ property :end_time, as: 'endTime'
219
+ property :links, as: 'links', class: Google::Apis::CloudtraceV2::Links, decorator: Google::Apis::CloudtraceV2::Links::Representation
220
+
221
+ property :name, as: 'name'
222
+ property :parent_span_id, as: 'parentSpanId'
223
+ property :same_process_as_parent_span, as: 'sameProcessAsParentSpan'
224
+ property :span_id, as: 'spanId'
225
+ property :span_kind, as: 'spanKind'
226
+ property :stack_trace, as: 'stackTrace', class: Google::Apis::CloudtraceV2::StackTrace, decorator: Google::Apis::CloudtraceV2::StackTrace::Representation
227
+
228
+ property :start_time, as: 'startTime'
229
+ property :status, as: 'status', class: Google::Apis::CloudtraceV2::Status, decorator: Google::Apis::CloudtraceV2::Status::Representation
230
+
231
+ property :time_events, as: 'timeEvents', class: Google::Apis::CloudtraceV2::TimeEvents, decorator: Google::Apis::CloudtraceV2::TimeEvents::Representation
232
+
233
+ end
234
+ end
235
+
236
+ class StackFrame
237
+ # @private
238
+ class Representation < Google::Apis::Core::JsonRepresentation
239
+ property :column_number, :numeric_string => true, as: 'columnNumber'
240
+ property :file_name, as: 'fileName', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
241
+
242
+ property :function_name, as: 'functionName', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
243
+
244
+ property :line_number, :numeric_string => true, as: 'lineNumber'
245
+ property :load_module, as: 'loadModule', class: Google::Apis::CloudtraceV2::Module, decorator: Google::Apis::CloudtraceV2::Module::Representation
246
+
247
+ property :original_function_name, as: 'originalFunctionName', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
248
+
249
+ property :source_version, as: 'sourceVersion', class: Google::Apis::CloudtraceV2::TruncatableString, decorator: Google::Apis::CloudtraceV2::TruncatableString::Representation
250
+
251
+ end
252
+ end
253
+
254
+ class StackFrames
255
+ # @private
256
+ class Representation < Google::Apis::Core::JsonRepresentation
257
+ property :dropped_frames_count, as: 'droppedFramesCount'
258
+ collection :frame, as: 'frame', class: Google::Apis::CloudtraceV2::StackFrame, decorator: Google::Apis::CloudtraceV2::StackFrame::Representation
259
+
260
+ end
261
+ end
262
+
263
+ class StackTrace
264
+ # @private
265
+ class Representation < Google::Apis::Core::JsonRepresentation
266
+ property :stack_frames, as: 'stackFrames', class: Google::Apis::CloudtraceV2::StackFrames, decorator: Google::Apis::CloudtraceV2::StackFrames::Representation
267
+
268
+ property :stack_trace_hash_id, :numeric_string => true, as: 'stackTraceHashId'
269
+ end
270
+ end
271
+
272
+ class Status
273
+ # @private
274
+ class Representation < Google::Apis::Core::JsonRepresentation
275
+ property :code, as: 'code'
276
+ collection :details, as: 'details'
277
+ property :message, as: 'message'
278
+ end
279
+ end
280
+
281
+ class TimeEvent
282
+ # @private
283
+ class Representation < Google::Apis::Core::JsonRepresentation
284
+ property :annotation, as: 'annotation', class: Google::Apis::CloudtraceV2::Annotation, decorator: Google::Apis::CloudtraceV2::Annotation::Representation
285
+
286
+ property :message_event, as: 'messageEvent', class: Google::Apis::CloudtraceV2::MessageEvent, decorator: Google::Apis::CloudtraceV2::MessageEvent::Representation
287
+
288
+ property :time, as: 'time'
289
+ end
290
+ end
291
+
292
+ class TimeEvents
293
+ # @private
294
+ class Representation < Google::Apis::Core::JsonRepresentation
295
+ property :dropped_annotations_count, as: 'droppedAnnotationsCount'
296
+ property :dropped_message_events_count, as: 'droppedMessageEventsCount'
297
+ collection :time_event, as: 'timeEvent', class: Google::Apis::CloudtraceV2::TimeEvent, decorator: Google::Apis::CloudtraceV2::TimeEvent::Representation
298
+
299
+ end
300
+ end
301
+
302
+ class TruncatableString
303
+ # @private
304
+ class Representation < Google::Apis::Core::JsonRepresentation
305
+ property :truncated_byte_count, as: 'truncatedByteCount'
306
+ property :value, as: 'value'
307
+ end
308
+ end
309
+ end
310
+ end
311
+ end
@@ -0,0 +1,136 @@
1
+ # Copyright 2020 Google LLC
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
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module CloudtraceV2
23
+ # Cloud Trace API
24
+ #
25
+ # Sends application trace data to Cloud Trace for viewing. Trace data is
26
+ # collected for all App Engine applications by default. Trace data from other
27
+ # applications can be provided using this API. This library is used to interact
28
+ # with the Cloud Trace API directly. If you are looking to instrument your
29
+ # application for Cloud Trace, we recommend using OpenCensus.
30
+ #
31
+ # @example
32
+ # require 'google/apis/cloudtrace_v2'
33
+ #
34
+ # Cloudtrace = Google::Apis::CloudtraceV2 # Alias the module
35
+ # service = Cloudtrace::CloudTraceService.new
36
+ #
37
+ # @see https://cloud.google.com/trace
38
+ class CloudTraceService < Google::Apis::Core::BaseService
39
+ # @return [String]
40
+ # API key. Your API key identifies your project and provides you with API access,
41
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
42
+ attr_accessor :key
43
+
44
+ # @return [String]
45
+ # Available to use for quota purposes for server-side applications. Can be any
46
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
47
+ attr_accessor :quota_user
48
+
49
+ def initialize
50
+ super('https://cloudtrace.googleapis.com/', '',
51
+ client_name: 'google-apis-cloudtrace_v2',
52
+ client_version: Google::Apis::CloudtraceV2::GEM_VERSION)
53
+ @batch_path = 'batch'
54
+ end
55
+
56
+ # Sends new spans to new or existing traces. You cannot update existing spans.
57
+ # @param [String] name
58
+ # Required. The name of the project where the spans belong. The format is `
59
+ # projects/[PROJECT_ID]`.
60
+ # @param [Google::Apis::CloudtraceV2::BatchWriteSpansRequest] batch_write_spans_request_object
61
+ # @param [String] fields
62
+ # Selector specifying which fields to include in a partial response.
63
+ # @param [String] quota_user
64
+ # Available to use for quota purposes for server-side applications. Can be any
65
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
66
+ # @param [Google::Apis::RequestOptions] options
67
+ # Request-specific options
68
+ #
69
+ # @yield [result, err] Result & error if block supplied
70
+ # @yieldparam result [Google::Apis::CloudtraceV2::Empty] parsed result object
71
+ # @yieldparam err [StandardError] error object if request failed
72
+ #
73
+ # @return [Google::Apis::CloudtraceV2::Empty]
74
+ #
75
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
76
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
77
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
78
+ def batch_trace_write_spans(name, batch_write_spans_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
79
+ command = make_simple_command(:post, 'v2/{+name}/traces:batchWrite', options)
80
+ command.request_representation = Google::Apis::CloudtraceV2::BatchWriteSpansRequest::Representation
81
+ command.request_object = batch_write_spans_request_object
82
+ command.response_representation = Google::Apis::CloudtraceV2::Empty::Representation
83
+ command.response_class = Google::Apis::CloudtraceV2::Empty
84
+ command.params['name'] = name unless name.nil?
85
+ command.query['fields'] = fields unless fields.nil?
86
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
87
+ execute_or_queue_command(command, &block)
88
+ end
89
+
90
+ # Creates a new span.
91
+ # @param [String] name
92
+ # Required. The resource name of the span in the following format: projects/[
93
+ # PROJECT_ID]/traces/[TRACE_ID]/spans/SPAN_ID is a unique identifier for a trace
94
+ # within a project; it is a 32-character hexadecimal encoding of a 16-byte array.
95
+ # [SPAN_ID] is a unique identifier for a span within a trace; it is a 16-
96
+ # character hexadecimal encoding of an 8-byte array. It should not be zero.
97
+ # @param [Google::Apis::CloudtraceV2::Span] span_object
98
+ # @param [String] fields
99
+ # Selector specifying which fields to include in a partial response.
100
+ # @param [String] quota_user
101
+ # Available to use for quota purposes for server-side applications. Can be any
102
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
103
+ # @param [Google::Apis::RequestOptions] options
104
+ # Request-specific options
105
+ #
106
+ # @yield [result, err] Result & error if block supplied
107
+ # @yieldparam result [Google::Apis::CloudtraceV2::Span] parsed result object
108
+ # @yieldparam err [StandardError] error object if request failed
109
+ #
110
+ # @return [Google::Apis::CloudtraceV2::Span]
111
+ #
112
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
113
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
114
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
115
+ def create_project_trace_span_span(name, span_object = nil, fields: nil, quota_user: nil, options: nil, &block)
116
+ command = make_simple_command(:post, 'v2/{+name}', options)
117
+ command.request_representation = Google::Apis::CloudtraceV2::Span::Representation
118
+ command.request_object = span_object
119
+ command.response_representation = Google::Apis::CloudtraceV2::Span::Representation
120
+ command.response_class = Google::Apis::CloudtraceV2::Span
121
+ command.params['name'] = name unless name.nil?
122
+ command.query['fields'] = fields unless fields.nil?
123
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
124
+ execute_or_queue_command(command, &block)
125
+ end
126
+
127
+ protected
128
+
129
+ def apply_command_defaults(command)
130
+ command.query['key'] = key unless key.nil?
131
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end