Class: Google::Cloud::Debugger::Debuggee

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/debugger/debuggee.rb,
lib/google/cloud/debugger/debuggee/app_uniquifier_generator.rb

Overview

Debuggee

Represent a debuggee application. Contains information that identifies debuggee applications from each other. Maps to gRPC struct Devtools::Clouddebugger::V2::Debuggee.

It also automatically loads source context information generated from Cloud SDK. See Stackdriver Debugger doc for more information on how to generate this source context information when used on Google Container Engine and Google Compute engine. This step is taken care of if debuggee application is hosted on Google App Engine Flexibile.

To ensure the multiple instances of the application are indeed the same application, the debuggee also compute a "uniquifier" generated from source context or application source code.

Defined Under Namespace

Modules: AppUniquifierGenerator

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idString (readonly)

Registered Debuggee ID. Set by Stackdriver Debugger service when a debuggee application is sucessfully registered.

Returns:

  • (String)


62
63
64
# File 'lib/google/cloud/debugger/debuggee.rb', line 62

def id
  @id
end

#service_nameString (readonly)

Name for the debuggee application

Returns:

  • (String)


51
52
53
# File 'lib/google/cloud/debugger/debuggee.rb', line 51

def service_name
  @service_name
end

#service_versionString (readonly)

Version identifier for the debuggee application

Returns:

  • (String)


56
57
58
# File 'lib/google/cloud/debugger/debuggee.rb', line 56

def service_version
  @service_version
end

Instance Method Details

#registerBoolean

Register the current application as a debuggee with Stackdriver Debuggee service.

Returns:

  • (Boolean)

    True if registered sucessfully; otherwise false.



78
79
80
81
82
83
84
85
86
# File 'lib/google/cloud/debugger/debuggee.rb', line 78

def register
  begin
    response = service.register_debuggee to_grpc
    @id = response.debuggee.id
  rescue
    revoke_registration
  end
  registered?
end

#registered?Boolean

Check whether this debuggee is currently registered or not

Returns:

  • (Boolean)

    True if debuggee is registered; otherwise false.



91
92
93
# File 'lib/google/cloud/debugger/debuggee.rb', line 91

def registered?
  !id.nil?
end

#revoke_registrationObject

Revoke the registration of this debuggee



97
98
99
# File 'lib/google/cloud/debugger/debuggee.rb', line 97

def revoke_registration
  @id = nil
end

#to_grpcObject

Convert this debuggee into a gRPC Google::Devtools::Clouddebugger::V2::Debuggee struct.



104
105
106
107
108
109
# File 'lib/google/cloud/debugger/debuggee.rb', line 104

def to_grpc
  debuggee_args = build_request_arg

  Google::Devtools::Clouddebugger::V2::Debuggee.decode_json \
    debuggee_args.to_json
end