google-cloud-debugger 0.36.1 → 0.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +2 -1
  3. data/CHANGELOG.md +47 -0
  4. data/CONTRIBUTING.md +4 -4
  5. data/LOGGING.md +1 -1
  6. data/OVERVIEW.md +28 -59
  7. data/TROUBLESHOOTING.md +2 -8
  8. data/ext/google/cloud/debugger/debugger_c/tracer.c +8 -33
  9. data/lib/google-cloud-debugger.rb +14 -15
  10. data/lib/google/cloud/debugger.rb +18 -16
  11. data/lib/google/cloud/debugger/agent.rb +4 -1
  12. data/lib/google/cloud/debugger/breakpoint.rb +9 -9
  13. data/lib/google/cloud/debugger/breakpoint/evaluator.rb +19 -25
  14. data/lib/google/cloud/debugger/breakpoint/source_location.rb +6 -6
  15. data/lib/google/cloud/debugger/breakpoint/stack_frame.rb +5 -5
  16. data/lib/google/cloud/debugger/breakpoint/status_message.rb +4 -6
  17. data/lib/google/cloud/debugger/breakpoint/variable.rb +8 -11
  18. data/lib/google/cloud/debugger/breakpoint/variable_table.rb +1 -1
  19. data/lib/google/cloud/debugger/credentials.rb +9 -6
  20. data/lib/google/cloud/debugger/debuggee.rb +4 -4
  21. data/lib/google/cloud/debugger/middleware.rb +1 -1
  22. data/lib/google/cloud/debugger/rails.rb +2 -2
  23. data/lib/google/cloud/debugger/service.rb +28 -66
  24. data/lib/google/cloud/debugger/snappoint.rb +4 -7
  25. data/lib/google/cloud/debugger/transmitter.rb +1 -1
  26. data/lib/google/cloud/debugger/version.rb +1 -1
  27. metadata +14 -72
  28. data/lib/google/cloud/debugger/v2.rb +0 -243
  29. data/lib/google/cloud/debugger/v2/controller2_client.rb +0 -373
  30. data/lib/google/cloud/debugger/v2/controller2_client_config.json +0 -41
  31. data/lib/google/cloud/debugger/v2/credentials.rb +0 -42
  32. data/lib/google/cloud/debugger/v2/debugger2_client.rb +0 -481
  33. data/lib/google/cloud/debugger/v2/debugger2_client_config.json +0 -51
  34. data/lib/google/cloud/debugger/v2/doc/google/devtools/clouddebugger/v2/controller.rb +0 -91
  35. data/lib/google/cloud/debugger/v2/doc/google/devtools/clouddebugger/v2/data.rb +0 -443
  36. data/lib/google/cloud/debugger/v2/doc/google/devtools/clouddebugger/v2/debugger.rb +0 -151
  37. data/lib/google/cloud/debugger/v2/doc/google/devtools/source/v1/source_context.rb +0 -162
  38. data/lib/google/cloud/debugger/v2/doc/google/protobuf/empty.rb +0 -29
  39. data/lib/google/cloud/debugger/v2/doc/google/protobuf/timestamp.rb +0 -113
  40. data/lib/google/devtools/clouddebugger/v2/controller_pb.rb +0 -50
  41. data/lib/google/devtools/clouddebugger/v2/controller_services_pb.rb +0 -98
  42. data/lib/google/devtools/clouddebugger/v2/data_pb.rb +0 -108
  43. data/lib/google/devtools/clouddebugger/v2/debugger_pb.rb +0 -77
  44. data/lib/google/devtools/clouddebugger/v2/debugger_services_pb.rb +0 -66
  45. data/lib/google/devtools/source/v1/source_context_pb.rb +0 -90
@@ -1,373 +0,0 @@
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
- # https://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/controller.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
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/devtools/clouddebugger/v2/controller_pb"
29
- require "google/cloud/debugger/v2/credentials"
30
- require "google/cloud/debugger/version"
31
-
32
- module Google
33
- module Cloud
34
- module Debugger
35
- module V2
36
- # The Controller service provides the API for orchestrating a collection of
37
- # debugger agents to perform debugging tasks. These agents are each attached
38
- # to a process of an application which may include one or more replicas.
39
- #
40
- # The debugger agents register with the Controller to identify the application
41
- # being debugged, the Debuggee. All agents that register with the same data,
42
- # represent the same Debuggee, and are assigned the same `debuggee_id`.
43
- #
44
- # The debugger agents call the Controller to retrieve the list of active
45
- # Breakpoints. Agents with the same `debuggee_id` get the same breakpoints
46
- # list. An agent that can fulfill the breakpoint request updates the
47
- # Controller with the breakpoint result. The controller selects the first
48
- # result received and discards the rest of the results.
49
- # Agents that poll again for active breakpoints will no longer have
50
- # the completed breakpoint in the list and should remove that breakpoint from
51
- # their attached process.
52
- #
53
- # The Controller service does not provide a way to retrieve the results of
54
- # a completed breakpoint. This functionality is available using the Debugger
55
- # service.
56
- #
57
- # @!attribute [r] controller2_stub
58
- # @return [Google::Devtools::Clouddebugger::V2::Controller2::Stub]
59
- class Controller2Client
60
- # @private
61
- attr_reader :controller2_stub
62
-
63
- # The default address of the service.
64
- SERVICE_ADDRESS = "clouddebugger.googleapis.com".freeze
65
-
66
- # The default port of the service.
67
- DEFAULT_SERVICE_PORT = 443
68
-
69
- # The default set of gRPC interceptors.
70
- GRPC_INTERCEPTORS = []
71
-
72
- DEFAULT_TIMEOUT = 30
73
-
74
- # The scopes needed to make gRPC calls to all of the methods defined in
75
- # this service.
76
- ALL_SCOPES = [
77
- "https://www.googleapis.com/auth/cloud-platform",
78
- "https://www.googleapis.com/auth/cloud_debugger"
79
- ].freeze
80
-
81
-
82
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
83
- # Provides the means for authenticating requests made by the client. This parameter can
84
- # be many types.
85
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
86
- # authenticating requests made by this client.
87
- # A `String` will be treated as the path to the keyfile to be used for the construction of
88
- # credentials for this client.
89
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
90
- # credentials for this client.
91
- # A `GRPC::Core::Channel` will be used to make calls through.
92
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
93
- # should already be composed with a `GRPC::Core::CallCredentials` object.
94
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
95
- # metadata for requests, generally, to give OAuth credentials.
96
- # @param scopes [Array<String>]
97
- # The OAuth scopes for this service. This parameter is ignored if
98
- # an updater_proc is supplied.
99
- # @param client_config [Hash]
100
- # A Hash for call options for each method. See
101
- # Google::Gax#construct_settings for the structure of
102
- # this data. Falls back to the default config if not specified
103
- # or the specified config is missing data points.
104
- # @param timeout [Numeric]
105
- # The default timeout, in seconds, for calls made through this client.
106
- # @param metadata [Hash]
107
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
108
- # @param service_address [String]
109
- # Override for the service hostname, or `nil` to leave as the default.
110
- # @param service_port [Integer]
111
- # Override for the service port, or `nil` to leave as the default.
112
- # @param exception_transformer [Proc]
113
- # An optional proc that intercepts any exceptions raised during an API call to inject
114
- # custom error handling.
115
- def initialize \
116
- credentials: nil,
117
- scopes: ALL_SCOPES,
118
- client_config: {},
119
- timeout: DEFAULT_TIMEOUT,
120
- metadata: nil,
121
- service_address: nil,
122
- service_port: nil,
123
- exception_transformer: nil,
124
- lib_name: nil,
125
- lib_version: ""
126
- # These require statements are intentionally placed here to initialize
127
- # the gRPC module only when it's required.
128
- # See https://github.com/googleapis/toolkit/issues/446
129
- require "google/gax/grpc"
130
- require "google/devtools/clouddebugger/v2/controller_services_pb"
131
-
132
- credentials ||= Google::Cloud::Debugger::V2::Credentials.default
133
-
134
- if credentials.is_a?(String) || credentials.is_a?(Hash)
135
- updater_proc = Google::Cloud::Debugger::V2::Credentials.new(credentials).updater_proc
136
- end
137
- if credentials.is_a?(GRPC::Core::Channel)
138
- channel = credentials
139
- end
140
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
141
- chan_creds = credentials
142
- end
143
- if credentials.is_a?(Proc)
144
- updater_proc = credentials
145
- end
146
- if credentials.is_a?(Google::Auth::Credentials)
147
- updater_proc = credentials.updater_proc
148
- end
149
-
150
- package_version = Google::Cloud::Debugger::VERSION
151
-
152
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
153
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
154
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
155
- google_api_client << " grpc/#{GRPC::VERSION}"
156
- google_api_client.freeze
157
-
158
- headers = { :"x-goog-api-client" => google_api_client }
159
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
160
- headers[:"x-goog-user-project"] = credentials.quota_project_id
161
- end
162
- headers.merge!(metadata) unless metadata.nil?
163
- client_config_file = Pathname.new(__dir__).join(
164
- "controller2_client_config.json"
165
- )
166
- defaults = client_config_file.open do |f|
167
- Google::Gax.construct_settings(
168
- "google.devtools.clouddebugger.v2.Controller2",
169
- JSON.parse(f.read),
170
- client_config,
171
- Google::Gax::Grpc::STATUS_CODE_NAMES,
172
- timeout,
173
- errors: Google::Gax::Grpc::API_ERRORS,
174
- metadata: headers
175
- )
176
- end
177
-
178
- # Allow overriding the service path/port in subclasses.
179
- service_path = service_address || self.class::SERVICE_ADDRESS
180
- port = service_port || self.class::DEFAULT_SERVICE_PORT
181
- interceptors = self.class::GRPC_INTERCEPTORS
182
- @controller2_stub = Google::Gax::Grpc.create_stub(
183
- service_path,
184
- port,
185
- chan_creds: chan_creds,
186
- channel: channel,
187
- updater_proc: updater_proc,
188
- scopes: scopes,
189
- interceptors: interceptors,
190
- &Google::Devtools::Clouddebugger::V2::Controller2::Stub.method(:new)
191
- )
192
-
193
- @update_active_breakpoint = Google::Gax.create_api_call(
194
- @controller2_stub.method(:update_active_breakpoint),
195
- defaults["update_active_breakpoint"],
196
- exception_transformer: exception_transformer
197
- )
198
- @register_debuggee = Google::Gax.create_api_call(
199
- @controller2_stub.method(:register_debuggee),
200
- defaults["register_debuggee"],
201
- exception_transformer: exception_transformer
202
- )
203
- @list_active_breakpoints = Google::Gax.create_api_call(
204
- @controller2_stub.method(:list_active_breakpoints),
205
- defaults["list_active_breakpoints"],
206
- exception_transformer: exception_transformer,
207
- params_extractor: proc do |request|
208
- {'debuggee_id' => request.debuggee_id}
209
- end
210
- )
211
- end
212
-
213
- # Service calls
214
-
215
- # Updates the breakpoint state or mutable fields.
216
- # The entire Breakpoint message must be sent back to the controller service.
217
- #
218
- # Updates to active breakpoint fields are only allowed if the new value
219
- # does not change the breakpoint specification. Updates to the `location`,
220
- # `condition` and `expressions` fields should not alter the breakpoint
221
- # semantics. These may only make changes such as canonicalizing a value
222
- # or snapping the location to the correct line of code.
223
- #
224
- # @param debuggee_id [String]
225
- # Required. Identifies the debuggee being debugged.
226
- # @param breakpoint [Google::Devtools::Clouddebugger::V2::Breakpoint | Hash]
227
- # Required. Updated breakpoint information.
228
- # The field `id` must be set.
229
- # The agent must echo all Breakpoint specification fields in the update.
230
- # A hash of the same form as `Google::Devtools::Clouddebugger::V2::Breakpoint`
231
- # can also be provided.
232
- # @param options [Google::Gax::CallOptions]
233
- # Overrides the default settings for this call, e.g, timeout,
234
- # retries, etc.
235
- # @yield [result, operation] Access the result along with the RPC operation
236
- # @yieldparam result [Google::Devtools::Clouddebugger::V2::UpdateActiveBreakpointResponse]
237
- # @yieldparam operation [GRPC::ActiveCall::Operation]
238
- # @return [Google::Devtools::Clouddebugger::V2::UpdateActiveBreakpointResponse]
239
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
240
- # @example
241
- # require "google/cloud/debugger/v2"
242
- #
243
- # controller2_client = Google::Cloud::Debugger::V2::Controller2.new
244
- #
245
- # # TODO: Initialize `debuggee_id`:
246
- # debuggee_id = ''
247
- #
248
- # # TODO: Initialize `breakpoint`:
249
- # breakpoint = {}
250
- # response = controller2_client.update_active_breakpoint(debuggee_id, breakpoint)
251
-
252
- def update_active_breakpoint \
253
- debuggee_id,
254
- breakpoint,
255
- options: nil,
256
- &block
257
- req = {
258
- debuggee_id: debuggee_id,
259
- breakpoint: breakpoint
260
- }.delete_if { |_, v| v.nil? }
261
- req = Google::Gax::to_proto(req, Google::Devtools::Clouddebugger::V2::UpdateActiveBreakpointRequest)
262
- @update_active_breakpoint.call(req, options, &block)
263
- end
264
-
265
- # Registers the debuggee with the controller service.
266
- #
267
- # All agents attached to the same application must call this method with
268
- # exactly the same request content to get back the same stable `debuggee_id`.
269
- # Agents should call this method again whenever `google.rpc.Code.NOT_FOUND`
270
- # is returned from any controller method.
271
- #
272
- # This protocol allows the controller service to disable debuggees, recover
273
- # from data loss, or change the `debuggee_id` format. Agents must handle
274
- # `debuggee_id` value changing upon re-registration.
275
- #
276
- # @param debuggee [Google::Devtools::Clouddebugger::V2::Debuggee | Hash]
277
- # Required. Debuggee information to register.
278
- # The fields `project`, `uniquifier`, `description` and `agent_version`
279
- # of the debuggee must be set.
280
- # A hash of the same form as `Google::Devtools::Clouddebugger::V2::Debuggee`
281
- # can also be provided.
282
- # @param options [Google::Gax::CallOptions]
283
- # Overrides the default settings for this call, e.g, timeout,
284
- # retries, etc.
285
- # @yield [result, operation] Access the result along with the RPC operation
286
- # @yieldparam result [Google::Devtools::Clouddebugger::V2::RegisterDebuggeeResponse]
287
- # @yieldparam operation [GRPC::ActiveCall::Operation]
288
- # @return [Google::Devtools::Clouddebugger::V2::RegisterDebuggeeResponse]
289
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
290
- # @example
291
- # require "google/cloud/debugger/v2"
292
- #
293
- # controller2_client = Google::Cloud::Debugger::V2::Controller2.new
294
- #
295
- # # TODO: Initialize `debuggee`:
296
- # debuggee = {}
297
- # response = controller2_client.register_debuggee(debuggee)
298
-
299
- def register_debuggee \
300
- debuggee,
301
- options: nil,
302
- &block
303
- req = {
304
- debuggee: debuggee
305
- }.delete_if { |_, v| v.nil? }
306
- req = Google::Gax::to_proto(req, Google::Devtools::Clouddebugger::V2::RegisterDebuggeeRequest)
307
- @register_debuggee.call(req, options, &block)
308
- end
309
-
310
- # Returns the list of all active breakpoints for the debuggee.
311
- #
312
- # The breakpoint specification (`location`, `condition`, and `expressions`
313
- # fields) is semantically immutable, although the field values may
314
- # change. For example, an agent may update the location line number
315
- # to reflect the actual line where the breakpoint was set, but this
316
- # doesn't change the breakpoint semantics.
317
- #
318
- # This means that an agent does not need to check if a breakpoint has changed
319
- # when it encounters the same breakpoint on a successive call.
320
- # Moreover, an agent should remember the breakpoints that are completed
321
- # until the controller removes them from the active list to avoid
322
- # setting those breakpoints again.
323
- #
324
- # @param debuggee_id [String]
325
- # Required. Identifies the debuggee.
326
- # @param wait_token [String]
327
- # A token that, if specified, blocks the method call until the list
328
- # of active breakpoints has changed, or a server-selected timeout has
329
- # expired. The value should be set from the `next_wait_token` field in
330
- # the last response. The initial value should be set to `"init"`.
331
- # @param success_on_timeout [true, false]
332
- # If set to `true` (recommended), returns `google.rpc.Code.OK` status and
333
- # sets the `wait_expired` response field to `true` when the server-selected
334
- # timeout has expired.
335
- #
336
- # If set to `false` (deprecated), returns `google.rpc.Code.ABORTED` status
337
- # when the server-selected timeout has expired.
338
- # @param options [Google::Gax::CallOptions]
339
- # Overrides the default settings for this call, e.g, timeout,
340
- # retries, etc.
341
- # @yield [result, operation] Access the result along with the RPC operation
342
- # @yieldparam result [Google::Devtools::Clouddebugger::V2::ListActiveBreakpointsResponse]
343
- # @yieldparam operation [GRPC::ActiveCall::Operation]
344
- # @return [Google::Devtools::Clouddebugger::V2::ListActiveBreakpointsResponse]
345
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
346
- # @example
347
- # require "google/cloud/debugger/v2"
348
- #
349
- # controller2_client = Google::Cloud::Debugger::V2::Controller2.new
350
- #
351
- # # TODO: Initialize `debuggee_id`:
352
- # debuggee_id = ''
353
- # response = controller2_client.list_active_breakpoints(debuggee_id)
354
-
355
- def list_active_breakpoints \
356
- debuggee_id,
357
- wait_token: nil,
358
- success_on_timeout: nil,
359
- options: nil,
360
- &block
361
- req = {
362
- debuggee_id: debuggee_id,
363
- wait_token: wait_token,
364
- success_on_timeout: success_on_timeout
365
- }.delete_if { |_, v| v.nil? }
366
- req = Google::Gax::to_proto(req, Google::Devtools::Clouddebugger::V2::ListActiveBreakpointsRequest)
367
- @list_active_breakpoints.call(req, options, &block)
368
- end
369
- end
370
- end
371
- end
372
- end
373
- end
@@ -1,41 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.devtools.clouddebugger.v2.Controller2": {
4
- "retry_codes": {
5
- "idempotent": [
6
- "DEADLINE_EXCEEDED",
7
- "UNAVAILABLE"
8
- ],
9
- "non_idempotent": []
10
- },
11
- "retry_params": {
12
- "default": {
13
- "initial_retry_delay_millis": 100,
14
- "retry_delay_multiplier": 1.3,
15
- "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 60000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 60000,
19
- "total_timeout_millis": 600000
20
- }
21
- },
22
- "methods": {
23
- "UpdateActiveBreakpoint": {
24
- "timeout_millis": 60000,
25
- "retry_codes_name": "idempotent",
26
- "retry_params_name": "default"
27
- },
28
- "RegisterDebuggee": {
29
- "timeout_millis": 60000,
30
- "retry_codes_name": "non_idempotent",
31
- "retry_params_name": "default"
32
- },
33
- "ListActiveBreakpoints": {
34
- "timeout_millis": 60000,
35
- "retry_codes_name": "idempotent",
36
- "retry_params_name": "default"
37
- }
38
- }
39
- }
40
- }
41
- }
@@ -1,42 +0,0 @@
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
- # https://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 "googleauth"
17
-
18
- module Google
19
- module Cloud
20
- module Debugger
21
- module V2
22
- class Credentials < Google::Auth::Credentials
23
- SCOPE = [
24
- "https://www.googleapis.com/auth/cloud-platform",
25
- "https://www.googleapis.com/auth/cloud_debugger"
26
- ].freeze
27
- PATH_ENV_VARS = %w(DEBUGGER_CREDENTIALS
28
- DEBUGGER_KEYFILE
29
- GOOGLE_CLOUD_CREDENTIALS
30
- GOOGLE_CLOUD_KEYFILE
31
- GCLOUD_KEYFILE)
32
- JSON_ENV_VARS = %w(DEBUGGER_CREDENTIALS_JSON
33
- DEBUGGER_KEYFILE_JSON
34
- GOOGLE_CLOUD_CREDENTIALS_JSON
35
- GOOGLE_CLOUD_KEYFILE_JSON
36
- GCLOUD_KEYFILE_JSON)
37
- DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
38
- end
39
- end
40
- end
41
- end
42
- end