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)


64
65
66
# File 'lib/google/cloud/debugger/debuggee.rb', line 64

def id
  @id
end

#service_nameString (readonly)

Name for the debuggee application

Returns:

  • (String)


53
54
55
# File 'lib/google/cloud/debugger/debuggee.rb', line 53

def service_name
  @service_name
end

#service_versionString (readonly)

Version identifier for the debuggee application

Returns:

  • (String)


58
59
60
# File 'lib/google/cloud/debugger/debuggee.rb', line 58

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.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/google/cloud/debugger/debuggee.rb', line 82

def register
  # Wait if backoff applies
  sleep @register_backoff.interval if @register_backoff.backing_off?

  begin
    response = service.register_debuggee to_grpc
    @id = response.debuggee.id
  rescue
    revoke_registration
  end

  registered = registered?
  registered ? @register_backoff.succeeded : @register_backoff.failed

  registered
end

#registered?Boolean

Check whether this debuggee is currently registered or not

Returns:

  • (Boolean)

    True if debuggee is registered; otherwise false.



102
103
104
# File 'lib/google/cloud/debugger/debuggee.rb', line 102

def registered?
  !id.nil?
end

#revoke_registrationObject

Revoke the registration of this debuggee



108
109
110
# File 'lib/google/cloud/debugger/debuggee.rb', line 108

def revoke_registration
  @id = nil
end

#to_grpcObject

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



115
116
117
118
119
120
# File 'lib/google/cloud/debugger/debuggee.rb', line 115

def to_grpc
  debuggee_args = build_request_arg

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