This gem provides monitoring and instrumentation APIs for Ruby. The instrumentation API allows you to measure how certain actions are carried out within Ruby code, such as in a web application or a third-party gem. It is not coupled with any framework and is easy to integrate into any application.

It does a couple of things for you:

  • Ability to subscribe and publish event notifications
  • Has an interface compatible with ActiveSupport::Notifications for easy integration with other frameworks
  • Plugins to monitor SQL queries, HTTP requests, and others

Basic Usage

require 'dry-monitor'

notifications = do |n|

logger =

notifications.subscribe('component.render') do |event| "Component rendered: #{event.payload}"

notifications.instrument('component.render', component_name: 'TestComponent') { sleep 0.2 }

# => INFO -- : Component rendered: {:component_name=>"TestComponent", :time=>201}

octocatEdit on GitHub