google-cloud-debugger - Class Google::Cloud::Debugger::Agent (v0.42.2)

Reference documentation and code samples for the google-cloud-debugger class Google::Cloud::Debugger::Agent.

Agent

The Stackdriver Debugger Agent runs on the same system where a debuggee application is running. The agent is responsible for sending state data, such as the value of program variables and the call stack, to Stackdriver Debugger when the code at a breakpoint location is executed.

The Debugger Agent runs in its own child thread when started. It ensures the instrumented application is registered properly and constantly monitors for any active breakpoints. Once the agent gets updated with active breakpoints from Stackdriver Debugger service, it facilitates the breakpoints in application requests thread, then transport the result snapshot back to Stackdriver Debugger service asynchronously.

Inherits

  • Object

Includes

  • Stackdriver::Core::AsyncActor

Example

require "google/cloud/debugger"

debugger = Google::Cloud::Debugger.new
agent = debugger.agent
agent.start

Methods

#app_root

def app_root() -> String

Absolute path to the debuggee Ruby application root directory. The Stackdriver Debugger service creates canonical breakpoints with only relative path. So the debugger agent combines the relative path to the application directory to trace and evaluate breakpoints.

Returns
  • (String)

#app_root=

def app_root=(value) -> String

Absolute path to the debuggee Ruby application root directory. The Stackdriver Debugger service creates canonical breakpoints with only relative path. So the debugger agent combines the relative path to the application directory to trace and evaluate breakpoints.

Parameter
  • value (String)
Returns
  • (String)

#breakpoint_manager

def breakpoint_manager() -> Google::Cloud::Debugger::BreakpointManager

It manages syncing breakpoints between the Debugger Agent and Stackdriver Debugger service

#debuggee

def debuggee() -> Google::Cloud::Debugger::Debuggee

The gRPC Debuggee representation of the debuggee application. It contains identification information to match running application to specific Cloud Source Repository code base, and correctly group same versions of the debuggee application together through a generated unique identifier.

#initialize

def initialize(service, service_name:, service_version:, logger: nil, app_root: nil) -> Agent

Create a new Debugger Agent instance.

Parameters
  • service (Google::Cloud::Debugger::Service) — The gRPC Service object
  • logger (Google::Cloud::Logging::Logger) (defaults to: nil) — The logger used to write the results of Logpoints.
  • service_name (String) — Name for the debuggee application.
  • service_version (String) — Version identifier for the debuggee application.
  • app_root (String) (defaults to: nil) — Absolute path to the root directory of the debuggee application. Default to Rack root.
Returns
  • (Agent) — a new instance of Agent

#logger

def logger()

The logger used to write the results of Logpoints.

#logger=

def logger=(value)

The logger used to write the results of Logpoints.

#quota_manager

def quota_manager()

A quota tracking object helps tracking resource consumption during evaluations.

#quota_manager=

def quota_manager=(value)

A quota tracking object helps tracking resource consumption during evaluations.

#start

def start()

Starts the Debugger Agent in a child thread, where debuggee application registration and breakpoints querying will take place. It also starts the transmitter in another child thread.

#stop

def stop()

Stops and terminates the Debugger Agent. It also properly shuts down transmitter and tracer.

Once Debugger Agent is stopped, it cannot be started again.

#stop_tracer

def stop_tracer()

Stops the tracer regardless of whether any active breakpoints are present. Once the tracer stops monitoring the debuggee application, the application can return to normal performance.

#tracer

def tracer() -> Google::Cloud::Debugger::Tracer

It monitors the debuggee application and triggers breakpoint evaluation when breakpoints are set.

#transmitter

def transmitter() -> Google::Cloud::Debugger::Transmiter

It sends evaluated breakpoints snapshot back to Stackdriver Debugger Service.

Returns
  • (Google::Cloud::Debugger::Transmiter)

Constants

DEFAULT_LOG_NAME

value: "debugger_logpoints".freeze
Name of the logpoints log file.