Class: Karafka::Instrumentation::Callbacks::Error
- Inherits:
-
Object
- Object
- Karafka::Instrumentation::Callbacks::Error
- Defined in:
- lib/karafka/instrumentation/callbacks/error.rb
Overview
Callback that kicks in when consumer 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(subscription_group_id, consumer_group_id, client_name, monitor) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(subscription_group_id, consumer_group_id, client_name, monitor) ⇒ Error
Returns a new instance of Error.
13 14 15 16 17 18 |
# File 'lib/karafka/instrumentation/callbacks/error.rb', line 13 def initialize(subscription_group_id, consumer_group_id, client_name, monitor) @subscription_group_id = subscription_group_id @consumer_group_id = consumer_group_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 consumer
Runs the instrumentation monitor with error
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/karafka/instrumentation/callbacks/error.rb', line 24 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', subscription_group_id: @subscription_group_id, consumer_group_id: @consumer_group_id, type: 'librdkafka.error', error: error ) end |