google-cloud-debugger 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +8 -0
- data/LICENSE +201 -0
- data/README.md +56 -0
- data/ext/google/cloud/debugger/debugger_c/debugger.c +31 -0
- data/ext/google/cloud/debugger/debugger_c/debugger.h +26 -0
- data/ext/google/cloud/debugger/debugger_c/evaluator.c +78 -0
- data/ext/google/cloud/debugger/debugger_c/evaluator.h +25 -0
- data/ext/google/cloud/debugger/debugger_c/extconf.rb +22 -0
- data/ext/google/cloud/debugger/debugger_c/tracer.c +478 -0
- data/ext/google/cloud/debugger/debugger_c/tracer.h +31 -0
- data/lib/google-cloud-debugger.rb +121 -0
- data/lib/google/cloud/debugger.rb +379 -0
- data/lib/google/cloud/debugger/agent.rb +204 -0
- data/lib/google/cloud/debugger/async_actor.rb +290 -0
- data/lib/google/cloud/debugger/breakpoint.rb +382 -0
- data/lib/google/cloud/debugger/breakpoint/evaluator.rb +1113 -0
- data/lib/google/cloud/debugger/breakpoint/source_location.rb +75 -0
- data/lib/google/cloud/debugger/breakpoint/stack_frame.rb +109 -0
- data/lib/google/cloud/debugger/breakpoint/variable.rb +304 -0
- data/lib/google/cloud/debugger/breakpoint_manager.rb +217 -0
- data/lib/google/cloud/debugger/credentials.rb +41 -0
- data/lib/google/cloud/debugger/debuggee.rb +204 -0
- data/lib/google/cloud/debugger/debuggee/app_uniquifier_generator.rb +78 -0
- data/lib/google/cloud/debugger/middleware.rb +77 -0
- data/lib/google/cloud/debugger/project.rb +135 -0
- data/lib/google/cloud/debugger/rails.rb +141 -0
- data/lib/google/cloud/debugger/service.rb +130 -0
- data/lib/google/cloud/debugger/tracer.rb +165 -0
- data/lib/google/cloud/debugger/transmitter.rb +129 -0
- data/lib/google/cloud/debugger/v2.rb +15 -0
- data/lib/google/cloud/debugger/v2/controller2_client.rb +299 -0
- data/lib/google/cloud/debugger/v2/controller2_client_config.json +43 -0
- data/lib/google/cloud/debugger/v2/debugger2_client.rb +378 -0
- data/lib/google/cloud/debugger/v2/debugger2_client_config.json +53 -0
- data/lib/google/cloud/debugger/v2/doc/google/devtools/clouddebugger/v2/data.rb +441 -0
- data/lib/google/cloud/debugger/v2/doc/google/devtools/clouddebugger/v2/debugger.rb +151 -0
- data/lib/google/cloud/debugger/v2/doc/google/devtools/source/v1/source_context.rb +161 -0
- data/lib/google/cloud/debugger/v2/doc/google/protobuf/timestamp.rb +81 -0
- data/lib/google/cloud/debugger/version.rb +22 -0
- data/lib/google/devtools/clouddebugger/v2/controller_pb.rb +47 -0
- data/lib/google/devtools/clouddebugger/v2/controller_services_pb.rb +97 -0
- data/lib/google/devtools/clouddebugger/v2/data_pb.rb +105 -0
- data/lib/google/devtools/clouddebugger/v2/debugger_pb.rb +74 -0
- data/lib/google/devtools/clouddebugger/v2/debugger_services_pb.rb +64 -0
- data/lib/google/devtools/source/v1/source_context_pb.rb +89 -0
- metadata +300 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2017 Google Inc. All rights reserved.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#ifndef GOOGLE_CLOUD_RUBY_DEBUGGER_TRACER_H_
|
18
|
+
#define GOOGLE_CLOUD_RUBY_DEBUGGER_TRACER_H_
|
19
|
+
|
20
|
+
#include "ruby/debug.h"
|
21
|
+
|
22
|
+
#define FILE_TRACEPOINT_EVENT (RUBY_EVENT_CLASS | RUBY_EVENT_CALL | RUBY_EVENT_C_CALL | RUBY_EVENT_B_CALL)
|
23
|
+
#define FIBER_TRACEPOINT_EVENT RUBY_EVENT_FIBER_SWITCH
|
24
|
+
|
25
|
+
/* To prevent unused parameter warnings */
|
26
|
+
#define UNUSED(x) (void)(x)
|
27
|
+
|
28
|
+
void
|
29
|
+
Init_tracer(VALUE mDebugger);
|
30
|
+
|
31
|
+
#endif // GOOGLE_CLOUD_RUBY_DEBUGGER_TRACER_H_
|
@@ -0,0 +1,121 @@
|
|
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
|
+
##
|
16
|
+
# This file is here to be autorequired by bundler, so that the .debugger and
|
17
|
+
# #debugger methods can be available, but the library and all dependencies won't
|
18
|
+
# be loaded until required and used.
|
19
|
+
|
20
|
+
|
21
|
+
gem "google-cloud-core"
|
22
|
+
require "google/cloud"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
##
|
27
|
+
# Creates a new debugger object for instrumenting Stackdriver Debugger for
|
28
|
+
# an application. Each call creates a new debugger agent with independent
|
29
|
+
# connection service.
|
30
|
+
#
|
31
|
+
# For more information on connecting to Google Cloud see the [Authentication
|
32
|
+
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
|
33
|
+
#
|
34
|
+
# @param [String] module_name Name for the debuggee application. Optional.
|
35
|
+
# @param [String] module_version Version identifier for the debuggee
|
36
|
+
# application. Optional.
|
37
|
+
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
|
38
|
+
# set of resources and operations that the connection can access. See
|
39
|
+
# [Using OAuth 2.0 to Access Google
|
40
|
+
# APIs](https://developers.google.com/identity/protocols/OAuth2).
|
41
|
+
#
|
42
|
+
# The default scope is:
|
43
|
+
#
|
44
|
+
# * `https://www.googleapis.com/auth/cloud_debugger`
|
45
|
+
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
46
|
+
# @param [Hash] client_config A hash of values to override the default
|
47
|
+
# behavior of the API client. Optional.
|
48
|
+
#
|
49
|
+
# @return [Google::Cloud::Debugger::Project]
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# require "google/cloud"
|
53
|
+
#
|
54
|
+
# gcloud = Google::Cloud.new
|
55
|
+
# debugger = gcloud.debugger
|
56
|
+
#
|
57
|
+
# debugger.start
|
58
|
+
#
|
59
|
+
# @example The default scope can be overridden with the `scope` option:
|
60
|
+
# require "google/cloud"
|
61
|
+
#
|
62
|
+
# gcloud = Google::Cloud.new
|
63
|
+
# platform_scope = "https://www.googleapis.com/auth/cloud-platform"
|
64
|
+
# debugger = gcloud.debugger scope: platform_scope
|
65
|
+
#
|
66
|
+
def debugger module_name: nil, module_version: nil, scope: nil,
|
67
|
+
timeout: nil, client_config: nil
|
68
|
+
Google::Cloud.debugger @project, @keyfile, module_name: module_name,
|
69
|
+
module_version: module_version,
|
70
|
+
scope: scope,
|
71
|
+
timeout: (timeout || @timeout),
|
72
|
+
client_config: client_config
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Creates a new debugger object for instrumenting Stackdriver Debugger for
|
77
|
+
# an application. Each call creates a new debugger agent with independent
|
78
|
+
# connection service.
|
79
|
+
#
|
80
|
+
# For more information on connecting to Google Cloud see the [Authentication
|
81
|
+
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
|
82
|
+
#
|
83
|
+
# @param [String] project Project identifier for the Stackdriver Debugger
|
84
|
+
# service you are connecting to.
|
85
|
+
# @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If
|
86
|
+
# file path the file must be readable.
|
87
|
+
# @param [String] module_name Name for the debuggee application. Optional.
|
88
|
+
# @param [String] module_version Version identifier for the debuggee
|
89
|
+
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
|
90
|
+
# set of resources and operations that the connection can access. See
|
91
|
+
# [Using OAuth 2.0 to Access Google
|
92
|
+
# APIs](https://developers.google.com/identity/protocols/OAuth2).
|
93
|
+
#
|
94
|
+
# The default scope is:
|
95
|
+
#
|
96
|
+
# * `https://www.googleapis.com/auth/cloud_debugger`
|
97
|
+
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
98
|
+
# @param [Hash] client_config A hash of values to override the default
|
99
|
+
# behavior of the API client. Optional.
|
100
|
+
#
|
101
|
+
# @return [Google::Cloud::Debugger::Project]
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
# require "google/cloud"
|
105
|
+
#
|
106
|
+
# debugger = Google::Cloud.debugger
|
107
|
+
#
|
108
|
+
# debugger.start
|
109
|
+
#
|
110
|
+
def self.debugger project = nil, keyfile = nil, module_name: nil,
|
111
|
+
module_version: nil, scope: nil, timeout: nil,
|
112
|
+
client_config: nil
|
113
|
+
require "google/cloud/debugger"
|
114
|
+
Google::Cloud::Debugger.new project: project, keyfile: keyfile,
|
115
|
+
module_name: module_name,
|
116
|
+
module_version: module_version,
|
117
|
+
scope: scope, timeout: timeout,
|
118
|
+
client_config: client_config
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,379 @@
|
|
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
|
+
|
16
|
+
require "google-cloud-debugger"
|
17
|
+
require "google/cloud/debugger/project"
|
18
|
+
|
19
|
+
module Google
|
20
|
+
module Cloud
|
21
|
+
##
|
22
|
+
# # Stackdriver Debugger
|
23
|
+
#
|
24
|
+
# Stackdriver Debugger is a feature of the Google Cloud Platform that lets
|
25
|
+
# you inspect the state of an application at any code location without using
|
26
|
+
# logging statements and without stopping or slowing down your applications.
|
27
|
+
# Your users are not impacted during debugging. Using the production
|
28
|
+
# debugger you can capture the local variables and call stack and link it
|
29
|
+
# back to a specific line location in your source code. You can use this to
|
30
|
+
# analyze the production state of your application and understand the
|
31
|
+
# behavior of your code in production.
|
32
|
+
#
|
33
|
+
# For general information about Stackdriver Debugger, read [Stackdriver
|
34
|
+
# Debugger Documentation](https://cloud.google.com/debugger/docs/).
|
35
|
+
#
|
36
|
+
# The Stackdriver Debugger Ruby library, `google-cloud-debugger`, provides:
|
37
|
+
#
|
38
|
+
# * Easy-to-use debugger instrumentation that reports state data, such as
|
39
|
+
# value of program variables and the call stack, to Stackdriver Debugger
|
40
|
+
# when the code at a breakpoint location is executed in your Ruby
|
41
|
+
# application. See the [instrumenting your app](#instrumenting-your-app)
|
42
|
+
# section for how to debug your application, in both development and
|
43
|
+
# production.
|
44
|
+
# * An idiomatic Ruby API for registerying debuggee application, and
|
45
|
+
# querying or manipulating breakpoints in registered Ruby debuggee
|
46
|
+
# application. See [Debugger API](#stackdriver-debugger-api) section for
|
47
|
+
# an introduction to Stackdriver Debugger API.
|
48
|
+
#
|
49
|
+
# ## Instrumenting Your App
|
50
|
+
#
|
51
|
+
# This instrumentation library provides the following features to help you
|
52
|
+
# debug your applications in production:
|
53
|
+
#
|
54
|
+
# * Automatic application registration. It facilitates multiple running
|
55
|
+
# instances of same version of application when hosted in production.
|
56
|
+
# * A background debugger agent that runs side-by-side with your
|
57
|
+
# application that automatically collects state data when code is
|
58
|
+
# executed at breakpoint locations.
|
59
|
+
# * A Rack middleware and Railtie that automatically manages the debugger
|
60
|
+
# agent for Ruby on Rails and other Rack-based Ruby applications.
|
61
|
+
#
|
62
|
+
# When this library is configured in your running application, and the
|
63
|
+
# source code and breakpoints are setup through the Google Cloud Console,
|
64
|
+
# You'll be able to
|
65
|
+
# [interact](https://cloud.google.com/debugger/docs/debugging) with your
|
66
|
+
# application in real time through the [Stackdriver Debugger
|
67
|
+
# UI](https://console.cloud.google.com/debug?_ga=1.84295834.280814654.1476313407).
|
68
|
+
# This library also integrates with Google App Engine Flexible to make
|
69
|
+
# debuggee application configuration more seemless.
|
70
|
+
#
|
71
|
+
# Note that when no breakpoints are created, the debugger agent consumes
|
72
|
+
# very little resource and has no interference with the running application.
|
73
|
+
# Once breakpoints are created and depends on where the breakpoints are
|
74
|
+
# located, the debugger agent may add a little latency onto each request.
|
75
|
+
# The application performance will be back to normal after all breakpoints
|
76
|
+
# are finished being evaluated. Be aware the more breakpoints are created,
|
77
|
+
# or the harder to reach the breakpoints, the more resource the debugger
|
78
|
+
# agent would need to consume.
|
79
|
+
#
|
80
|
+
# ### Using instrumentation with Ruby on Rails
|
81
|
+
#
|
82
|
+
# To install application instrumentation in your Ruby on Rails app, add this
|
83
|
+
# gem, `google-cloud-debugger`, to your Gemfile and update your bundle. Then
|
84
|
+
# add the following line to your `config/application.rb` file:
|
85
|
+
#
|
86
|
+
# ```ruby
|
87
|
+
# require "google/cloud/debugger/rails"
|
88
|
+
# ```
|
89
|
+
#
|
90
|
+
# This will load a Railtie that automatically integrates with the Rails
|
91
|
+
# framework by injecting a Rack middleware. The Railtie also takes in the
|
92
|
+
# following Rails configuration as parameter of the debugger agent
|
93
|
+
# initialization:
|
94
|
+
#
|
95
|
+
# ```ruby
|
96
|
+
# # Explicitly enable or disable Stackdriver Debugger Agent
|
97
|
+
# config.google_cloud.use_debugger = true
|
98
|
+
# # Shared Google Cloud Platform project identifier
|
99
|
+
# config.google_cloud.project_id = "gcloud-project"
|
100
|
+
# # Google Cloud Platform project identifier for Stackdriver Debugger only
|
101
|
+
# config.google_cloud.debugger.project_id = "debugger-project"
|
102
|
+
# # Shared Google Cloud authentication json file
|
103
|
+
# config.google_cloud.keyfile = "/path/to/keyfile.json"
|
104
|
+
# # Google Cloud authentication json file for Stackdriver Debugger only
|
105
|
+
# config.google_cloud.debugger.keyfile = "/path/to/debugger/keyfile.json"
|
106
|
+
# # Stackdriver Debugger Agent module name identifier
|
107
|
+
# config.google_cloud.debugger.module_name = "my-ruby-app"
|
108
|
+
# # Stackdriver Debugger Agent module version identifier
|
109
|
+
# config.google_cloud.debugger.module_version = "v1"
|
110
|
+
# ```
|
111
|
+
#
|
112
|
+
# See the {Google::Cloud::Debugger::Railtie} class for more information.
|
113
|
+
#
|
114
|
+
# ### Using instrumentation with Sinatra
|
115
|
+
#
|
116
|
+
# To install application instrumentation in your Sinatra app, add this gem,
|
117
|
+
# `google-cloud-debugger`, to your Gemfile and update your bundle. Then add
|
118
|
+
# the following lines to your main application Ruby file:
|
119
|
+
#
|
120
|
+
# ```ruby
|
121
|
+
# require "google/cloud/debugger"
|
122
|
+
# use Google::Cloud::Debugger::Middleware
|
123
|
+
# ```
|
124
|
+
#
|
125
|
+
# This will install the debugger middleware in your application.
|
126
|
+
#
|
127
|
+
# Configuration parameters may also be passed in as arguments to Middleware.
|
128
|
+
# ```ruby
|
129
|
+
# require "google/cloud/debugger"
|
130
|
+
# use Google::Cloud::Debugger::Middleware project: "debugger-project-id",
|
131
|
+
# keyfile: "/path/to/keyfile.json",
|
132
|
+
# module_name: "my-ruby-app",
|
133
|
+
# module_version: "v1"
|
134
|
+
# ```
|
135
|
+
#
|
136
|
+
# ### Using instrumentation with other Rack-based frameworks
|
137
|
+
#
|
138
|
+
# To install application instrumentation in an app using another Rack-based
|
139
|
+
# web framework, add this gem, `google-cloud-debugger`, to your Gemfile and
|
140
|
+
# update your bundle. Then add install the debugger middleware in your
|
141
|
+
# middleware stack. In most cases, this means adding these lines to your
|
142
|
+
# `config.ru` Rack configuration file:
|
143
|
+
#
|
144
|
+
# ```ruby
|
145
|
+
# require "google/cloud/debugger"
|
146
|
+
# use Google::Cloud::Debugger::Middleware
|
147
|
+
# ```
|
148
|
+
#
|
149
|
+
# Some web frameworks have an alternate mechanism for modifying the
|
150
|
+
# middleware stack. Consult your web framework's documentation for more
|
151
|
+
# information.
|
152
|
+
#
|
153
|
+
# ### The Stackdriver diagnostics suite
|
154
|
+
#
|
155
|
+
# The debugger library is part of the Stackdriver diagnostics suite, which
|
156
|
+
# also includes error reporting, log analysis, and tracing analysis. If you
|
157
|
+
# include the `stackdriver` gem in your Gemfile, this debugger library will
|
158
|
+
# be included automatically. In addition, if you include the `stackdriver`
|
159
|
+
# gem in an application using Ruby On Rails, the Railties will be installed
|
160
|
+
# automatically. See the documentation for the "stackdriver" gem
|
161
|
+
# for more details.
|
162
|
+
#
|
163
|
+
# ## Stackdriver Debugger API
|
164
|
+
#
|
165
|
+
# This library also includes an easy to use Ruby client for the
|
166
|
+
# Stackdriver Debugger API. This API provides calls to register debuggee
|
167
|
+
# application, as well as creating or modifying breakpoints.
|
168
|
+
#
|
169
|
+
# For further information on the Debugger API, see
|
170
|
+
# {Google::Cloud::Debugger::Project}
|
171
|
+
#
|
172
|
+
# ### Registering debuggee application
|
173
|
+
#
|
174
|
+
# ```ruby
|
175
|
+
# require "google/cloud/debugger/v2"
|
176
|
+
#
|
177
|
+
# Controller2Client = Google::Cloud::Debugger::V2::Controller2Client
|
178
|
+
# Debuggee = Google::Devtools::Clouddebugger::V2::Debuggee
|
179
|
+
#
|
180
|
+
# controller2_client = Controller2Client.new
|
181
|
+
# debuggee = Debuggee.new
|
182
|
+
# response = controller2_client.register_debuggee(debuggee)
|
183
|
+
# debuggee_id = response.debuggee.id
|
184
|
+
# ```
|
185
|
+
# See [Stackdriver Debugger Debuggee
|
186
|
+
# doc](https://cloud.google.com/debugger/api/reference/rpc/google.devtools.clouddebugger.v2#google.devtools.clouddebugger.v2.Debuggee)
|
187
|
+
# on fields necessary for registerying a debuggee.
|
188
|
+
#
|
189
|
+
# Upon successful registration, the response debuggee object will contain
|
190
|
+
# a debuggee_id that's later needed to interact with the other Stackdriver
|
191
|
+
# Debugger API.
|
192
|
+
#
|
193
|
+
# See {Google::Cloud::Debugger::V2::Controller2Client} for details.
|
194
|
+
#
|
195
|
+
# ### List Active Breakpoints
|
196
|
+
#
|
197
|
+
# ```ruby
|
198
|
+
# require "google/cloud/debugger/v2"
|
199
|
+
#
|
200
|
+
# Controller2Client = Google::Cloud::Debugger::V2::Controller2Client
|
201
|
+
# controller2_client = Controller2Client.new
|
202
|
+
#
|
203
|
+
# debuggee_id = ''
|
204
|
+
# response = controller2_client.list_active_breakpoints(debuggee_id)
|
205
|
+
# breakpoints = response.breakpoints
|
206
|
+
# ```
|
207
|
+
#
|
208
|
+
# See {Google::Cloud::Debugger::V2::Controller2Client} for details.
|
209
|
+
#
|
210
|
+
# ### Update Active Breakpoint
|
211
|
+
#
|
212
|
+
# Users can send custom snapshots for active breakpoints using this API.
|
213
|
+
#
|
214
|
+
# ```ruby
|
215
|
+
# require "google/cloud/debugger/v2"
|
216
|
+
#
|
217
|
+
# Breakpoint = Google::Devtools::Clouddebugger::V2::Breakpoint
|
218
|
+
# Controller2Client = Google::Cloud::Debugger::V2::Controller2Client
|
219
|
+
#
|
220
|
+
# controller2_client = Controller2Client.new
|
221
|
+
# debuggee_id = ''
|
222
|
+
# breakpoint = Breakpoint.new
|
223
|
+
# response =
|
224
|
+
# controller2_client.update_active_breakpoint(debuggee_id, breakpoint)
|
225
|
+
# ```
|
226
|
+
#
|
227
|
+
# See [Stackdriver Debugger Breakpoint
|
228
|
+
# doc](https://cloud.google.com/debugger/api/reference/rpc/google.devtools.clouddebugger.v2#google.devtools.clouddebugger.v2.Breakpoint)
|
229
|
+
# for all available fields for breakpoint.
|
230
|
+
#
|
231
|
+
# See {Google::Cloud::Debugger::V2::Controller2Client} for details.
|
232
|
+
#
|
233
|
+
# ### Set Breakpoint
|
234
|
+
#
|
235
|
+
# ```ruby
|
236
|
+
# require "google/cloud/debugger/v2"
|
237
|
+
#
|
238
|
+
# Breakpoint = Google::Devtools::Clouddebugger::V2::Breakpoint
|
239
|
+
# Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
|
240
|
+
#
|
241
|
+
# debugger2_client = Debugger2Client.new
|
242
|
+
# debuggee_id = ''
|
243
|
+
# breakpoint = Breakpoint.new
|
244
|
+
# client_version = ''
|
245
|
+
# response = debugger2_client.set_breakpoint(
|
246
|
+
# debuggee_id, breakpoint, client_version)
|
247
|
+
# ```
|
248
|
+
#
|
249
|
+
# See [Stackdriver Debugger Breakpoint
|
250
|
+
# doc](https://cloud.google.com/debugger/api/reference/rpc/google.devtools.clouddebugger.v2#google.devtools.clouddebugger.v2.Breakpoint)
|
251
|
+
# for fields needed to specify breakpoint location.
|
252
|
+
#
|
253
|
+
# See {Google::Cloud::Debugger::V2::Debugger2Client} for details.
|
254
|
+
#
|
255
|
+
# ### Get Breakpoint
|
256
|
+
#
|
257
|
+
# ```ruby
|
258
|
+
# require "google/cloud/debugger/v2"
|
259
|
+
#
|
260
|
+
# Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
|
261
|
+
#
|
262
|
+
# debugger2_client = Debugger2Client.new
|
263
|
+
# debuggee_id = ''
|
264
|
+
# breakpoint_id = ''
|
265
|
+
# client_version = ''
|
266
|
+
# response = debugger2_client.get_breakpoint(
|
267
|
+
# debuggee_id, breakpoint_id, client_version)
|
268
|
+
# ```
|
269
|
+
#
|
270
|
+
# See {Google::Cloud::Debugger::V2::Debugger2Client} for details.
|
271
|
+
#
|
272
|
+
# ### Delete Breakpoint
|
273
|
+
#
|
274
|
+
# ```ruby
|
275
|
+
# require "google/cloud/debugger/v2"
|
276
|
+
#
|
277
|
+
# Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
|
278
|
+
#
|
279
|
+
# debugger2_client = Debugger2Client.new
|
280
|
+
# debuggee_id = ''
|
281
|
+
# breakpoint_id = ''
|
282
|
+
# client_version = ''
|
283
|
+
# debugger2_client.delete_breakpoint(
|
284
|
+
# debuggee_id, breakpoint_id, client_version)
|
285
|
+
# ```
|
286
|
+
#
|
287
|
+
# See {Google::Cloud::Debugger::V2::Debugger2Client} for details.
|
288
|
+
#
|
289
|
+
# ### List Breakpoints
|
290
|
+
#
|
291
|
+
# ```ruby
|
292
|
+
# require "google/cloud/debugger/v2"
|
293
|
+
#
|
294
|
+
# Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
|
295
|
+
#
|
296
|
+
# Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
|
297
|
+
#
|
298
|
+
# debugger2_client = Debugger2Client.new
|
299
|
+
# debuggee_id = ''
|
300
|
+
# client_version = ''
|
301
|
+
# response = debugger2_client.list_breakpoints(debuggee_id, client_version)
|
302
|
+
# ```
|
303
|
+
#
|
304
|
+
# See {Google::Cloud::Debugger::V2::Debugger2Client} for details.
|
305
|
+
#
|
306
|
+
# ### List Debuggees
|
307
|
+
#
|
308
|
+
# ```ruby
|
309
|
+
# require "google/cloud/debugger/v2"
|
310
|
+
#
|
311
|
+
# Debugger2Client = Google::Cloud::Debugger::V2::Debugger2Client
|
312
|
+
#
|
313
|
+
# debugger2_client = Debugger2Client.new
|
314
|
+
# project = ''
|
315
|
+
# client_version = ''
|
316
|
+
# response = debugger2_client.list_debuggees(project, client_version)
|
317
|
+
# ```
|
318
|
+
#
|
319
|
+
# See {Google::Cloud::Debugger::V2::Debugger2Client} for details.
|
320
|
+
#
|
321
|
+
module Debugger
|
322
|
+
##
|
323
|
+
# Creates a new debugger object for instrumenting Stackdriver Debugger for
|
324
|
+
# an application. Each call creates a new debugger agent with independent
|
325
|
+
# connection service.
|
326
|
+
#
|
327
|
+
# For more information on connecting to Google Cloud see the
|
328
|
+
# [Authentication
|
329
|
+
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
|
330
|
+
#
|
331
|
+
# @param [String] project Project identifier for the Stackdriver Debugger
|
332
|
+
# service.
|
333
|
+
# @param [String, Hash] keyfile Keyfile downloaded from Google Cloud:
|
334
|
+
# either the JSON data or the path to a readable file.
|
335
|
+
# @param [String] module_name Name for the debuggee application. Optional.
|
336
|
+
# @param [String] module_version Version identifier for the debuggee
|
337
|
+
# application. Optional.
|
338
|
+
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
|
339
|
+
# the set of resources and operations that the connection can access.
|
340
|
+
# See [Using OAuth 2.0 to Access Google
|
341
|
+
# APIs](https://developers.google.com/identity/protocols/OAuth2).
|
342
|
+
# The default scope is `https://www.googleapis.com/auth/cloud-platform`
|
343
|
+
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
344
|
+
#
|
345
|
+
# @return [Google::Cloud::Debugger::Project]
|
346
|
+
#
|
347
|
+
# @example
|
348
|
+
# require "google/cloud/debugger"
|
349
|
+
#
|
350
|
+
# debugger = Google::Cloud::Debugger.new
|
351
|
+
# debugger.start
|
352
|
+
#
|
353
|
+
def self.new project: nil, keyfile: nil, module_name: nil,
|
354
|
+
module_version: nil, scope: nil, timeout: nil,
|
355
|
+
client_config: nil
|
356
|
+
project ||= Debugger::Project.default_project
|
357
|
+
project = project.to_s # Always cast to a string
|
358
|
+
module_name ||= Debugger::Project.default_module_name
|
359
|
+
module_name = module_name.to_s
|
360
|
+
module_version ||= Debugger::Project.default_module_version
|
361
|
+
module_version = module_version.to_s
|
362
|
+
|
363
|
+
fail ArgumentError, "project is missing" if project.empty?
|
364
|
+
fail ArgumentError, "module_name is missing" if module_name.empty?
|
365
|
+
fail ArgumentError, "module_version is missing" if module_version.nil?
|
366
|
+
|
367
|
+
credentials = Credentials.credentials_with_scope keyfile, scope
|
368
|
+
|
369
|
+
Google::Cloud::Debugger::Project.new(
|
370
|
+
Google::Cloud::Debugger::Service.new(
|
371
|
+
project, credentials, timeout: timeout,
|
372
|
+
client_config: client_config),
|
373
|
+
module_name: module_name,
|
374
|
+
module_version: module_version
|
375
|
+
)
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|