google-cloud-debugger 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +8 -0
  3. data/LICENSE +201 -0
  4. data/README.md +56 -0
  5. data/ext/google/cloud/debugger/debugger_c/debugger.c +31 -0
  6. data/ext/google/cloud/debugger/debugger_c/debugger.h +26 -0
  7. data/ext/google/cloud/debugger/debugger_c/evaluator.c +78 -0
  8. data/ext/google/cloud/debugger/debugger_c/evaluator.h +25 -0
  9. data/ext/google/cloud/debugger/debugger_c/extconf.rb +22 -0
  10. data/ext/google/cloud/debugger/debugger_c/tracer.c +478 -0
  11. data/ext/google/cloud/debugger/debugger_c/tracer.h +31 -0
  12. data/lib/google-cloud-debugger.rb +121 -0
  13. data/lib/google/cloud/debugger.rb +379 -0
  14. data/lib/google/cloud/debugger/agent.rb +204 -0
  15. data/lib/google/cloud/debugger/async_actor.rb +290 -0
  16. data/lib/google/cloud/debugger/breakpoint.rb +382 -0
  17. data/lib/google/cloud/debugger/breakpoint/evaluator.rb +1113 -0
  18. data/lib/google/cloud/debugger/breakpoint/source_location.rb +75 -0
  19. data/lib/google/cloud/debugger/breakpoint/stack_frame.rb +109 -0
  20. data/lib/google/cloud/debugger/breakpoint/variable.rb +304 -0
  21. data/lib/google/cloud/debugger/breakpoint_manager.rb +217 -0
  22. data/lib/google/cloud/debugger/credentials.rb +41 -0
  23. data/lib/google/cloud/debugger/debuggee.rb +204 -0
  24. data/lib/google/cloud/debugger/debuggee/app_uniquifier_generator.rb +78 -0
  25. data/lib/google/cloud/debugger/middleware.rb +77 -0
  26. data/lib/google/cloud/debugger/project.rb +135 -0
  27. data/lib/google/cloud/debugger/rails.rb +141 -0
  28. data/lib/google/cloud/debugger/service.rb +130 -0
  29. data/lib/google/cloud/debugger/tracer.rb +165 -0
  30. data/lib/google/cloud/debugger/transmitter.rb +129 -0
  31. data/lib/google/cloud/debugger/v2.rb +15 -0
  32. data/lib/google/cloud/debugger/v2/controller2_client.rb +299 -0
  33. data/lib/google/cloud/debugger/v2/controller2_client_config.json +43 -0
  34. data/lib/google/cloud/debugger/v2/debugger2_client.rb +378 -0
  35. data/lib/google/cloud/debugger/v2/debugger2_client_config.json +53 -0
  36. data/lib/google/cloud/debugger/v2/doc/google/devtools/clouddebugger/v2/data.rb +441 -0
  37. data/lib/google/cloud/debugger/v2/doc/google/devtools/clouddebugger/v2/debugger.rb +151 -0
  38. data/lib/google/cloud/debugger/v2/doc/google/devtools/source/v1/source_context.rb +161 -0
  39. data/lib/google/cloud/debugger/v2/doc/google/protobuf/timestamp.rb +81 -0
  40. data/lib/google/cloud/debugger/version.rb +22 -0
  41. data/lib/google/devtools/clouddebugger/v2/controller_pb.rb +47 -0
  42. data/lib/google/devtools/clouddebugger/v2/controller_services_pb.rb +97 -0
  43. data/lib/google/devtools/clouddebugger/v2/data_pb.rb +105 -0
  44. data/lib/google/devtools/clouddebugger/v2/debugger_pb.rb +74 -0
  45. data/lib/google/devtools/clouddebugger/v2/debugger_services_pb.rb +64 -0
  46. data/lib/google/devtools/source/v1/source_context_pb.rb +89 -0
  47. metadata +300 -0
@@ -0,0 +1,43 @@
1
+ {
2
+ "interfaces": {
3
+ "google.devtools.clouddebugger.v2.Controller2": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "UNAVAILABLE"
8
+ ],
9
+ "non_idempotent": [
10
+ "UNAVAILABLE"
11
+ ]
12
+ },
13
+ "retry_params": {
14
+ "default": {
15
+ "initial_retry_delay_millis": 100,
16
+ "retry_delay_multiplier": 1.3,
17
+ "max_retry_delay_millis": 60000,
18
+ "initial_rpc_timeout_millis": 60000,
19
+ "rpc_timeout_multiplier": 1.0,
20
+ "max_rpc_timeout_millis": 60000,
21
+ "total_timeout_millis": 600000
22
+ }
23
+ },
24
+ "methods": {
25
+ "RegisterDebuggee": {
26
+ "timeout_millis": 60000,
27
+ "retry_codes_name": "non_idempotent",
28
+ "retry_params_name": "default"
29
+ },
30
+ "ListActiveBreakpoints": {
31
+ "timeout_millis": 60000,
32
+ "retry_codes_name": "idempotent",
33
+ "retry_params_name": "default"
34
+ },
35
+ "UpdateActiveBreakpoint": {
36
+ "timeout_millis": 60000,
37
+ "retry_codes_name": "idempotent",
38
+ "retry_params_name": "default"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,378 @@
1
+ # Copyright 2017, 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/clouddebugger/v2/debugger.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
+
30
+ require "google/devtools/clouddebugger/v2/debugger_pb"
31
+
32
+ module Google
33
+ module Cloud
34
+ module Debugger
35
+ module V2
36
+ # The Debugger service provides the API that allows users to collect run-time
37
+ # information from a running application, without stopping or slowing it down
38
+ # and without modifying its state. An application may include one or
39
+ # more replicated processes performing the same work.
40
+ #
41
+ # The application is represented using the Debuggee concept. The Debugger
42
+ # service provides a way to query for available Debuggees, but does not
43
+ # provide a way to create one. A debuggee is created using the Controller
44
+ # service, usually by running a debugger agent with the application.
45
+ #
46
+ # The Debugger service enables the client to set one or more Breakpoints on a
47
+ # Debuggee and collect the results of the set Breakpoints.
48
+ #
49
+ # @!attribute [r] debugger2_stub
50
+ # @return [Google::Devtools::Clouddebugger::V2::Debugger2::Stub]
51
+ class Debugger2Client
52
+ attr_reader :debugger2_stub
53
+
54
+ # The default address of the service.
55
+ SERVICE_ADDRESS = "clouddebugger.googleapis.com".freeze
56
+
57
+ # The default port of the service.
58
+ DEFAULT_SERVICE_PORT = 443
59
+
60
+ DEFAULT_TIMEOUT = 30
61
+
62
+ # The scopes needed to make gRPC calls to all of the methods defined in
63
+ # this service.
64
+ ALL_SCOPES = [
65
+ "https://www.googleapis.com/auth/cloud-platform",
66
+ "https://www.googleapis.com/auth/cloud_debugger"
67
+ ].freeze
68
+
69
+ # @param service_path [String]
70
+ # The domain name of the API remote host.
71
+ # @param port [Integer]
72
+ # The port on which to connect to the remote host.
73
+ # @param channel [Channel]
74
+ # A Channel object through which to make calls.
75
+ # @param chan_creds [Grpc::ChannelCredentials]
76
+ # A ChannelCredentials for the setting up the RPC client.
77
+ # @param client_config[Hash]
78
+ # A Hash for call options for each method. See
79
+ # Google::Gax#construct_settings for the structure of
80
+ # this data. Falls back to the default config if not specified
81
+ # or the specified config is missing data points.
82
+ # @param timeout [Numeric]
83
+ # The default timeout, in seconds, for calls made through this client.
84
+ def initialize \
85
+ service_path: SERVICE_ADDRESS,
86
+ port: DEFAULT_SERVICE_PORT,
87
+ channel: nil,
88
+ chan_creds: nil,
89
+ scopes: ALL_SCOPES,
90
+ client_config: {},
91
+ timeout: DEFAULT_TIMEOUT,
92
+ app_name: nil,
93
+ app_version: nil,
94
+ lib_name: nil,
95
+ lib_version: ""
96
+ # These require statements are intentionally placed here to initialize
97
+ # the gRPC module only when it's required.
98
+ # See https://github.com/googleapis/toolkit/issues/446
99
+ require "google/gax/grpc"
100
+ require "google/devtools/clouddebugger/v2/debugger_services_pb"
101
+
102
+
103
+ if app_name || app_version
104
+ warn "`app_name` and `app_version` are no longer being used in the request headers."
105
+ end
106
+
107
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
108
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
109
+ google_api_client << " gapic/0.6.8 gax/#{Google::Gax::VERSION}"
110
+ google_api_client << " grpc/#{GRPC::VERSION}"
111
+ google_api_client.freeze
112
+
113
+ headers = { :"x-goog-api-client" => google_api_client }
114
+ client_config_file = Pathname.new(__dir__).join(
115
+ "debugger2_client_config.json"
116
+ )
117
+ defaults = client_config_file.open do |f|
118
+ Google::Gax.construct_settings(
119
+ "google.devtools.clouddebugger.v2.Debugger2",
120
+ JSON.parse(f.read),
121
+ client_config,
122
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
123
+ timeout,
124
+ errors: Google::Gax::Grpc::API_ERRORS,
125
+ kwargs: headers
126
+ )
127
+ end
128
+ @debugger2_stub = Google::Gax::Grpc.create_stub(
129
+ service_path,
130
+ port,
131
+ chan_creds: chan_creds,
132
+ channel: channel,
133
+ scopes: scopes,
134
+ &Google::Devtools::Clouddebugger::V2::Debugger2::Stub.method(:new)
135
+ )
136
+
137
+ @set_breakpoint = Google::Gax.create_api_call(
138
+ @debugger2_stub.method(:set_breakpoint),
139
+ defaults["set_breakpoint"]
140
+ )
141
+ @get_breakpoint = Google::Gax.create_api_call(
142
+ @debugger2_stub.method(:get_breakpoint),
143
+ defaults["get_breakpoint"]
144
+ )
145
+ @delete_breakpoint = Google::Gax.create_api_call(
146
+ @debugger2_stub.method(:delete_breakpoint),
147
+ defaults["delete_breakpoint"]
148
+ )
149
+ @list_breakpoints = Google::Gax.create_api_call(
150
+ @debugger2_stub.method(:list_breakpoints),
151
+ defaults["list_breakpoints"]
152
+ )
153
+ @list_debuggees = Google::Gax.create_api_call(
154
+ @debugger2_stub.method(:list_debuggees),
155
+ defaults["list_debuggees"]
156
+ )
157
+ end
158
+
159
+ # Service calls
160
+
161
+ # Sets the breakpoint to the debuggee.
162
+ #
163
+ # @param debuggee_id [String]
164
+ # ID of the debuggee where the breakpoint is to be set.
165
+ # @param breakpoint [Google::Devtools::Clouddebugger::V2::Breakpoint]
166
+ # Breakpoint specification to set.
167
+ # The field 'location' of the breakpoint must be set.
168
+ # @param client_version [String]
169
+ # The client version making the call.
170
+ # Following: +domain/type/version+ (e.g., +google.com/intellij/v1+).
171
+ # @param options [Google::Gax::CallOptions]
172
+ # Overrides the default settings for this call, e.g, timeout,
173
+ # retries, etc.
174
+ # @return [Google::Devtools::Clouddebugger::V2::SetBreakpointResponse]
175
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
176
+ # @example
177
+ # require "google/cloud/debugger/v2/debugger2_client"
178
+ #
179
+ # Breakpoint = Google::Devtools::Clouddebugger::V2::Breakpoint
180
+ # Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
181
+ #
182
+ # debugger2_client = Debugger2Client.new
183
+ # debuggee_id = ''
184
+ # breakpoint = Breakpoint.new
185
+ # client_version = ''
186
+ # response = debugger2_client.set_breakpoint(debuggee_id, breakpoint, client_version)
187
+
188
+ def set_breakpoint \
189
+ debuggee_id,
190
+ breakpoint,
191
+ client_version,
192
+ options: nil
193
+ req = Google::Devtools::Clouddebugger::V2::SetBreakpointRequest.new({
194
+ debuggee_id: debuggee_id,
195
+ breakpoint: breakpoint,
196
+ client_version: client_version
197
+ }.delete_if { |_, v| v.nil? })
198
+ @set_breakpoint.call(req, options)
199
+ end
200
+
201
+ # Gets breakpoint information.
202
+ #
203
+ # @param debuggee_id [String]
204
+ # ID of the debuggee whose breakpoint to get.
205
+ # @param breakpoint_id [String]
206
+ # ID of the breakpoint to get.
207
+ # @param client_version [String]
208
+ # The client version making the call.
209
+ # Following: +domain/type/version+ (e.g., +google.com/intellij/v1+).
210
+ # @param options [Google::Gax::CallOptions]
211
+ # Overrides the default settings for this call, e.g, timeout,
212
+ # retries, etc.
213
+ # @return [Google::Devtools::Clouddebugger::V2::GetBreakpointResponse]
214
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
215
+ # @example
216
+ # require "google/cloud/debugger/v2/debugger2_client"
217
+ #
218
+ # Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
219
+ #
220
+ # debugger2_client = Debugger2Client.new
221
+ # debuggee_id = ''
222
+ # breakpoint_id = ''
223
+ # client_version = ''
224
+ # response = debugger2_client.get_breakpoint(debuggee_id, breakpoint_id, client_version)
225
+
226
+ def get_breakpoint \
227
+ debuggee_id,
228
+ breakpoint_id,
229
+ client_version,
230
+ options: nil
231
+ req = Google::Devtools::Clouddebugger::V2::GetBreakpointRequest.new({
232
+ debuggee_id: debuggee_id,
233
+ breakpoint_id: breakpoint_id,
234
+ client_version: client_version
235
+ }.delete_if { |_, v| v.nil? })
236
+ @get_breakpoint.call(req, options)
237
+ end
238
+
239
+ # Deletes the breakpoint from the debuggee.
240
+ #
241
+ # @param debuggee_id [String]
242
+ # ID of the debuggee whose breakpoint to delete.
243
+ # @param breakpoint_id [String]
244
+ # ID of the breakpoint to delete.
245
+ # @param client_version [String]
246
+ # The client version making the call.
247
+ # Following: +domain/type/version+ (e.g., +google.com/intellij/v1+).
248
+ # @param options [Google::Gax::CallOptions]
249
+ # Overrides the default settings for this call, e.g, timeout,
250
+ # retries, etc.
251
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
252
+ # @example
253
+ # require "google/cloud/debugger/v2/debugger2_client"
254
+ #
255
+ # Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
256
+ #
257
+ # debugger2_client = Debugger2Client.new
258
+ # debuggee_id = ''
259
+ # breakpoint_id = ''
260
+ # client_version = ''
261
+ # debugger2_client.delete_breakpoint(debuggee_id, breakpoint_id, client_version)
262
+
263
+ def delete_breakpoint \
264
+ debuggee_id,
265
+ breakpoint_id,
266
+ client_version,
267
+ options: nil
268
+ req = Google::Devtools::Clouddebugger::V2::DeleteBreakpointRequest.new({
269
+ debuggee_id: debuggee_id,
270
+ breakpoint_id: breakpoint_id,
271
+ client_version: client_version
272
+ }.delete_if { |_, v| v.nil? })
273
+ @delete_breakpoint.call(req, options)
274
+ nil
275
+ end
276
+
277
+ # Lists all breakpoints for the debuggee.
278
+ #
279
+ # @param debuggee_id [String]
280
+ # ID of the debuggee whose breakpoints to list.
281
+ # @param client_version [String]
282
+ # The client version making the call.
283
+ # Following: +domain/type/version+ (e.g., +google.com/intellij/v1+).
284
+ # @param include_all_users [true, false]
285
+ # When set to +true+, the response includes the list of breakpoints set by
286
+ # any user. Otherwise, it includes only breakpoints set by the caller.
287
+ # @param include_inactive [true, false]
288
+ # When set to +true+, the response includes active and inactive
289
+ # breakpoints. Otherwise, it includes only active breakpoints.
290
+ # @param action [Google::Devtools::Clouddebugger::V2::ListBreakpointsRequest::BreakpointActionValue]
291
+ # When set, the response includes only breakpoints with the specified action.
292
+ # @param strip_results [true, false]
293
+ # This field is deprecated. The following fields are always stripped out of
294
+ # the result: +stack_frames+, +evaluated_expressions+ and +variable_table+.
295
+ # @param wait_token [String]
296
+ # A wait token that, if specified, blocks the call until the breakpoints
297
+ # list has changed, or a server selected timeout has expired. The value
298
+ # should be set from the last response. The error code
299
+ # +google.rpc.Code.ABORTED+ (RPC) is returned on wait timeout, which
300
+ # should be called again with the same +wait_token+.
301
+ # @param options [Google::Gax::CallOptions]
302
+ # Overrides the default settings for this call, e.g, timeout,
303
+ # retries, etc.
304
+ # @return [Google::Devtools::Clouddebugger::V2::ListBreakpointsResponse]
305
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
306
+ # @example
307
+ # require "google/cloud/debugger/v2/debugger2_client"
308
+ #
309
+ # Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
310
+ #
311
+ # debugger2_client = Debugger2Client.new
312
+ # debuggee_id = ''
313
+ # client_version = ''
314
+ # response = debugger2_client.list_breakpoints(debuggee_id, client_version)
315
+
316
+ def list_breakpoints \
317
+ debuggee_id,
318
+ client_version,
319
+ include_all_users: nil,
320
+ include_inactive: nil,
321
+ action: nil,
322
+ strip_results: nil,
323
+ wait_token: nil,
324
+ options: nil
325
+ req = Google::Devtools::Clouddebugger::V2::ListBreakpointsRequest.new({
326
+ debuggee_id: debuggee_id,
327
+ client_version: client_version,
328
+ include_all_users: include_all_users,
329
+ include_inactive: include_inactive,
330
+ action: action,
331
+ strip_results: strip_results,
332
+ wait_token: wait_token
333
+ }.delete_if { |_, v| v.nil? })
334
+ @list_breakpoints.call(req, options)
335
+ end
336
+
337
+ # Lists all the debuggees that the user can set breakpoints to.
338
+ #
339
+ # @param project [String]
340
+ # Project number of a Google Cloud project whose debuggees to list.
341
+ # @param client_version [String]
342
+ # The client version making the call.
343
+ # Following: +domain/type/version+ (e.g., +google.com/intellij/v1+).
344
+ # @param include_inactive [true, false]
345
+ # When set to +true+, the result includes all debuggees. Otherwise, the
346
+ # result includes only debuggees that are active.
347
+ # @param options [Google::Gax::CallOptions]
348
+ # Overrides the default settings for this call, e.g, timeout,
349
+ # retries, etc.
350
+ # @return [Google::Devtools::Clouddebugger::V2::ListDebuggeesResponse]
351
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
352
+ # @example
353
+ # require "google/cloud/debugger/v2/debugger2_client"
354
+ #
355
+ # Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
356
+ #
357
+ # debugger2_client = Debugger2Client.new
358
+ # project = ''
359
+ # client_version = ''
360
+ # response = debugger2_client.list_debuggees(project, client_version)
361
+
362
+ def list_debuggees \
363
+ project,
364
+ client_version,
365
+ include_inactive: nil,
366
+ options: nil
367
+ req = Google::Devtools::Clouddebugger::V2::ListDebuggeesRequest.new({
368
+ project: project,
369
+ client_version: client_version,
370
+ include_inactive: include_inactive
371
+ }.delete_if { |_, v| v.nil? })
372
+ @list_debuggees.call(req, options)
373
+ end
374
+ end
375
+ end
376
+ end
377
+ end
378
+ end
@@ -0,0 +1,53 @@
1
+ {
2
+ "interfaces": {
3
+ "google.devtools.clouddebugger.v2.Debugger2": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "UNAVAILABLE"
8
+ ],
9
+ "non_idempotent": [
10
+ "UNAVAILABLE"
11
+ ]
12
+ },
13
+ "retry_params": {
14
+ "default": {
15
+ "initial_retry_delay_millis": 100,
16
+ "retry_delay_multiplier": 1.3,
17
+ "max_retry_delay_millis": 60000,
18
+ "initial_rpc_timeout_millis": 60000,
19
+ "rpc_timeout_multiplier": 1.0,
20
+ "max_rpc_timeout_millis": 60000,
21
+ "total_timeout_millis": 600000
22
+ }
23
+ },
24
+ "methods": {
25
+ "SetBreakpoint": {
26
+ "timeout_millis": 60000,
27
+ "retry_codes_name": "non_idempotent",
28
+ "retry_params_name": "default"
29
+ },
30
+ "GetBreakpoint": {
31
+ "timeout_millis": 60000,
32
+ "retry_codes_name": "idempotent",
33
+ "retry_params_name": "default"
34
+ },
35
+ "DeleteBreakpoint": {
36
+ "timeout_millis": 60000,
37
+ "retry_codes_name": "idempotent",
38
+ "retry_params_name": "default"
39
+ },
40
+ "ListBreakpoints": {
41
+ "timeout_millis": 60000,
42
+ "retry_codes_name": "idempotent",
43
+ "retry_params_name": "default"
44
+ },
45
+ "ListDebuggees": {
46
+ "timeout_millis": 60000,
47
+ "retry_codes_name": "idempotent",
48
+ "retry_params_name": "default"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }