Class: Gruf::Instrumentation::Base
- Inherits:
-
Object
- Object
- Gruf::Instrumentation::Base
- Includes:
- Loggable
- Defined in:
- lib/gruf/instrumentation/base.rb
Overview
Base class for a hook. Define before, around, or after methods to utilize functionality.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#active_call ⇒ Object
readonly
Returns the value of attribute active_call.
-
#call_signature ⇒ Object
readonly
Returns the value of attribute call_signature.
-
#execution_time ⇒ Object
readonly
Returns the value of attribute execution_time.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(service, request, response, execution_time, call_signature, active_call, options = {}) ⇒ Base
constructor
A new instance of Base.
-
#setup ⇒ Object
Useful for setting up an instrumentation module post instantiation.
- #success? ⇒ Boolean
Methods included from Loggable
Constructor Details
#initialize(service, request, response, execution_time, call_signature, active_call, options = {}) ⇒ Base
Returns a new instance of Base.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gruf/instrumentation/base.rb', line 27 def initialize(service, request, response, execution_time, call_signature, active_call, = {}) @service = service @request = request @response = response @execution_time = execution_time @call_signature = call_signature.to_s.gsub('_without_intercept', '').to_sym @active_call = active_call = setup end |
Instance Attribute Details
#active_call ⇒ Object (readonly)
Returns the value of attribute active_call.
25 26 27 |
# File 'lib/gruf/instrumentation/base.rb', line 25 def active_call @active_call end |
#call_signature ⇒ Object (readonly)
Returns the value of attribute call_signature.
25 26 27 |
# File 'lib/gruf/instrumentation/base.rb', line 25 def call_signature @call_signature end |
#execution_time ⇒ Object (readonly)
Returns the value of attribute execution_time.
25 26 27 |
# File 'lib/gruf/instrumentation/base.rb', line 25 def execution_time @execution_time end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
25 26 27 |
# File 'lib/gruf/instrumentation/base.rb', line 25 def end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
25 26 27 |
# File 'lib/gruf/instrumentation/base.rb', line 25 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
25 26 27 |
# File 'lib/gruf/instrumentation/base.rb', line 25 def response @response end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
25 26 27 |
# File 'lib/gruf/instrumentation/base.rb', line 25 def service @service end |
Instance Method Details
#call ⇒ Object
54 55 56 |
# File 'lib/gruf/instrumentation/base.rb', line 54 def call raise NotImplementedError end |
#setup ⇒ Object
Useful for setting up an instrumentation module post instantiation
41 42 43 |
# File 'lib/gruf/instrumentation/base.rb', line 41 def setup # noop end |
#success? ⇒ Boolean
48 49 50 |
# File 'lib/gruf/instrumentation/base.rb', line 48 def success? !response.is_a?(GRPC::BadStatus) end |