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
Runs the instrumentation monitor with error
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/waterdrop/instrumentation/callbacks/error.rb', line 21 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', error: error, producer_id: @producer_id, type: 'librdkafka.error' ) end |