From 7237c7be74b09cd951ff000afb4087313e5c0025 Mon Sep 17 00:00:00 2001
From: Ali Ibrahim <aibrahim2k2@gmail.com>
Date: Fri, 22 Mar 2019 13:20:32 -0400
Subject: Update instrumentation guides w/optional block

---
 guides/source/active_support_instrumentation.md | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'guides/source')

diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md
index 89e0e3afa8..d7dbc5cea8 100644
--- a/guides/source/active_support_instrumentation.md
+++ b/guides/source/active_support_instrumentation.md
@@ -692,5 +692,16 @@ ActiveSupport::Notifications.subscribe "my.custom.event" do |name, started, fini
 end
 ```
 
+You also have the option to call instrument without passing a block. This lets you leverage the
+instrumentation infrastructure for other messaging uses.
+
+```ruby
+ActiveSupport::Notifications.instrument "my.custom.event", this: :data
+
+ActiveSupport::Notifications.subscribe "my.custom.event" do |name, started, finished, unique_id, data|
+  puts data.inspect # {:this=>:data}
+end
+```
+
 You should follow Rails conventions when defining your own events. The format is: `event.library`.
 If your application is sending Tweets, you should create an event named `tweet.twitter`.
-- 
cgit v1.2.3