README.md in coach-2.0.0 vs README.md in coach-2.1.0
- old
+ new
@@ -307,13 +307,24 @@
solution to Rails `process_action.action_controller` event emitted on controller requests.
The benchmarking data includes information on how long each middleware took to process,
along with the total duration of the chain.
+For coach to emit `request.coach` events, it first needs to be subscribed to handler/middleware events:
+
+```ruby
+Coach::Notifications.subscribe!
+
+# Now you can subscribe to and use request.coach events, e.g.
+ActiveSupport::Notifications.subscribe("request.coach") do |_, event|
+ Rails.logger.info(event)
+end
+```
+
You can add additional metadata to the notifications published by Coach by calling the
`log_metadata` method from inside your Coach middlewares.
-```
+```ruby
class Tracking < Coach::Middleware
requires :user
def call
log_metadata(user_id: user.id)