Class: WaterDrop::Instrumentation::Callbacks::Error
- Inherits:
-
Object
- Object
- WaterDrop::Instrumentation::Callbacks::Error
- Defined in:
- lib/waterdrop/instrumentation/callbacks/error.rb
Overview
Callback that kicks in when error occurs and is published in a background thread
Instance Method Summary collapse
-
#call(client_name, error) ⇒ Object
Runs the instrumentation monitor with error.
-
#initialize(producer_id, client_name, monitor) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(producer_id, client_name, monitor) ⇒ Error
Returns a new instance of Error.
11 12 13 14 15 |
# File 'lib/waterdrop/instrumentation/callbacks/error.rb', line 11 def initialize(producer_id, client_name, monitor) @producer_id = producer_id @client_name = client_name @monitor = monitor end |
Instance Method Details
#call(client_name, error) ⇒ Object
Note:
It will only instrument on errors of the client of our producer
Note:
When there is a particular message produce error (not internal error), the error is shipped via the delivery callback, not via error callback.
Runs the instrumentation monitor with error
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/waterdrop/instrumentation/callbacks/error.rb', line 23 def call(client_name, error) # Emit only errors related to our client # Same as with statistics (mor explanation there) return unless @client_name == client_name @monitor.instrument( 'error.occurred', caller: self, error: error, producer_id: @producer_id, type: 'librdkafka.error' ) end |