Module: Google::Cloud::Debugger
- Defined in:
- lib/google/cloud/debugger.rb,
lib/google/cloud/debugger/agent.rb,
lib/google/cloud/debugger/rails.rb,
lib/google/cloud/debugger/tracer.rb,
lib/google/cloud/debugger/backoff.rb,
lib/google/cloud/debugger/project.rb,
lib/google/cloud/debugger/service.rb,
lib/google/cloud/debugger/version.rb,
lib/google/cloud/debugger/debuggee.rb,
lib/google/cloud/debugger/logpoint.rb,
lib/google/cloud/debugger/snappoint.rb,
lib/google/cloud/debugger/breakpoint.rb,
lib/google/cloud/debugger/middleware.rb,
lib/google/cloud/debugger/credentials.rb,
lib/google/cloud/debugger/transmitter.rb,
lib/google/cloud/debugger/breakpoint_manager.rb,
lib/google/cloud/debugger/breakpoint/variable.rb,
lib/google/cloud/debugger/breakpoint/evaluator.rb,
lib/google/cloud/debugger/breakpoint/validator.rb,
lib/google/cloud/debugger/request_quota_manager.rb,
lib/google/cloud/debugger/breakpoint/stack_frame.rb,
lib/google/cloud/debugger/breakpoint/status_message.rb,
lib/google/cloud/debugger/breakpoint/variable_table.rb,
lib/google/cloud/debugger/breakpoint/source_location.rb,
lib/google/cloud/debugger/debuggee/app_uniquifier_generator.rb
Overview
Stackdriver Debugger
Stackdriver Debugger is a feature of the Google Cloud Platform that lets you inspect the state of an application at any code location without using logging statements and without stopping or slowing down your applications. Your users are not impacted during debugging. Using the production debugger you can capture the local variables and call stack and link it back to a specific line location in your source code. You can use this to analyze the production state of your application and understand the behavior of your code in production.
See Debugger Overview.
Defined Under Namespace
Classes: Agent, Breakpoint, BreakpointManager, Credentials, Debuggee, Logpoint, Middleware, Project, Railtie, RequestQuotaManager, Snappoint, Tracer, Transmitter, TransmitterError
Constant Summary collapse
- VERSION =
"0.42.2".freeze
Class Method Summary collapse
-
.allow_mutating_methods!(&block) ⇒ Object
Allow calling of potentially state-changing methods even if mutation detection is configured to be active.
-
.configure {|Google::Cloud.configure.debugger| ... } ⇒ Google::Cloud::Config
Configure the Stackdriver Debugger agent.
-
.new(project_id: nil, credentials: nil, service_name: nil, service_version: nil, scope: nil, timeout: nil, endpoint: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Debugger::Project
Creates a new debugger object for instrumenting Stackdriver Debugger for an application.
Class Method Details
.allow_mutating_methods!(&block) ⇒ Object
Allow calling of potentially state-changing methods even if mutation detection is configured to be active.
Generally it is unwise to run code that may change the program state (e.g. modifying instance variables or causing other side effects) in a breakpoint expression, because it could change the behavior of your program. However, the checks are currently quite conservative, and may block code that is actually safe to run. If you are certain your expression is safe to evaluate, you may use this method to disable side effect checks.
This method may be called with a block, in which case checks are disabled within the block. It may also be called without a block to disable side effect checks for the rest of the current expression; the default setting will be restored for the next expression.
This method may be called only from a debugger condition or expression
evaluation, and will throw an exception if you call it from normal
application code. Set the allow_mutating_methods
configuration if you
want to disable the side effect checker globally for your app.
245 246 247 248 249 250 251 |
# File 'lib/google/cloud/debugger.rb', line 245 def self.allow_mutating_methods! &block evaluator = Breakpoint::Evaluator.current if evaluator.nil? raise "allow_mutating_methods can be called only during evaluation" end evaluator.allow_mutating_methods!(&block) end |
.configure {|Google::Cloud.configure.debugger| ... } ⇒ Google::Cloud::Config
Configure the Stackdriver Debugger agent.
The following Stackdriver Debugger configuration parameters are supported:
project_id
- (String) Project identifier for the Stackdriver Debugger service you are connecting to. (The parameterproject
is considered deprecated, but may also be used.)credentials
- (String, Hash, Google::Auth::Credentials) The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See Credentials) (The parameterkeyfile
is considered deprecated, but may also be used.)service_name
- (String) Name for the debuggee application.service_version
- (String) Version identifier for the debuggee application.root
- (String) The root directory of the debuggee application as an absolute file path.scope
- (String, Array) The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. quota_project
- (String) The project ID for a project that can be used by client libraries for quota and billing purposes.timeout
- (Integer) Default timeout to use in requests.endpoint
- (String) Override of the endpoint host name, ornil
to use the default endpoint.allow_mutating_methods
- (boolean) Whether expressions and conditional breakpoints can call methods that could modify program state. Defaults to false.evaluation_time_limit
- (Numeric) Time limit in seconds for expression evaluation. Defaults to 0.05.on_error
- (Proc) A Proc to be run when an error is encountered on a background thread. The Proc must take the error object as the single argument.
See the Configuration Guide for full configuration parameters.
167 168 169 170 171 |
# File 'lib/google/cloud/debugger.rb', line 167 def self.configure yield Google::Cloud.configure.debugger if block_given? Google::Cloud.configure.debugger end |
.new(project_id: nil, credentials: nil, service_name: nil, service_version: nil, scope: nil, timeout: nil, endpoint: nil, project: nil, keyfile: nil) ⇒ Google::Cloud::Debugger::Project
Creates a new debugger object for instrumenting Stackdriver Debugger for an application. Each call creates a new debugger agent with independent connection service.
For more information on connecting to Google Cloud see the Authentication Guide.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/google/cloud/debugger.rb', line 85 def self.new project_id: nil, credentials: nil, service_name: nil, service_version: nil, scope: nil, timeout: nil, endpoint: nil, project: nil, keyfile: nil project_id ||= (project || default_project_id) service_name ||= default_service_name service_version ||= default_service_version scope ||= configure.scope timeout ||= configure.timeout endpoint ||= configure.endpoint service_name = service_name.to_s raise ArgumentError, "service_name is missing" if service_name.empty? service_version = service_version.to_s if service_version.nil? raise ArgumentError, "service_version is missing" end credentials ||= (keyfile || default_credentials(scope: scope)) unless credentials.is_a? Google::Auth::Credentials credentials = Debugger::Credentials.new credentials, scope: scope end if credentials.respond_to? :project_id project_id ||= credentials.project_id end project_id = project_id.to_s # Always cast to a string raise ArgumentError, "project_id is missing" if project_id.empty? service = Debugger::Service.new project_id, credentials, host: endpoint, timeout: timeout Debugger::Project.new service, service_name: service_name, service_version: service_version end |