[//]: # (This file is auto-generated by bin/refresh_instrumentation_events) [//]: # (Do not edit manually - changes will be overwritten) # WaterDrop Instrumentation Events This page lists all available instrumentation events for WaterDrop. ## WaterDrop Instrumentation Events / Overview WaterDrop uses a notification system that allows you to monitor and hook into various stages of message processing and producer operations. You can subscribe to any of these events to add custom monitoring, logging, or other functionality. ## WaterDrop Instrumentation Events / Available Events Below is the complete list of instrumentation events available in WaterDrop: ### WaterDrop Instrumentation Events / Available Events / Buffer Events - `buffer.flushed_async` - `buffer.flushed_sync` - `buffer.purged` ### WaterDrop Instrumentation Events / Available Events / Error Events - `error.occurred` ### WaterDrop Instrumentation Events / Available Events / Message Events - `message.acknowledged` - `message.buffered` - `message.produced_async` - `message.produced_sync` - `message.purged` ### WaterDrop Instrumentation Events / Available Events / Messages Events - `messages.buffered` - `messages.produced_async` - `messages.produced_sync` ### WaterDrop Instrumentation Events / Available Events / Oauthbearer Events - `oauthbearer.token_refresh` ### WaterDrop Instrumentation Events / Available Events / Poller Events - `poller.producer_registered` - `poller.producer_unregistered` ### WaterDrop Instrumentation Events / Available Events / Producer Events - `producer.closed` - `producer.closing` - `producer.connected` - `producer.disconnected` - `producer.disconnecting` - `producer.reload` - `producer.reloaded` ### WaterDrop Instrumentation Events / Available Events / Statistics Events - `statistics.emitted` ### WaterDrop Instrumentation Events / Available Events / Transaction Events - `transaction.aborted` - `transaction.committed` - `transaction.finished` - `transaction.marked_as_consumed` - `transaction.started` ## WaterDrop Instrumentation Events / Usage Example To subscribe to any of these events, you can use the instrumentation monitor: ```ruby WaterDrop::App.monitor.subscribe('event.name') do |event| # Your custom logic here puts "Event: #{event.id}" puts "Payload: #{event.payload}" end ``` For more information about using instrumentation, please refer to the main documentation. ## WaterDrop Instrumentation Events / Class-Level Events WaterDrop also provides class-level instrumentation that allows you to monitor events across all producer instances. This is useful for external libraries and monitoring tools that need to hook into producer lifecycle events without requiring specific producer instance references. ### WaterDrop Instrumentation Events / Class-Level Events / Available Class-Level Events #### WaterDrop Instrumentation Events / Class-Level Events / Available Class-Level Events / Connection_pool Events - `connection_pool.created` - `connection_pool.reload` - `connection_pool.reloaded` - `connection_pool.setup` - `connection_pool.shutdown` #### WaterDrop Instrumentation Events / Class-Level Events / Available Class-Level Events / Producer Events - `producer.configured` - `producer.created` ### WaterDrop Instrumentation Events / Class-Level Events / Class-Level Usage Example ```ruby # Subscribe to global producer lifecycle events WaterDrop.monitor.subscribe('producer.configured') do |event| producer = event[:producer] puts "Producer configured: #{producer.id}" # Example: Add middleware after producer is fully configured producer.middleware.append do |message| message end end # All producers will now trigger the above callback producer = WaterDrop::Producer.new do |config| config.kafka = { 'bootstrap.servers': 'localhost:9092' } end ``` For more details on class-level instrumentation patterns, see the [Monitoring and Logging](https://karafka.io/docs/WaterDrop-Monitoring-and-Logging.md#global-cross-producer-monitoring) documentation. --- *Last modified: 2026-02-17 17:14:17*