@@ -198,9 +198,10 @@ Pipeline.new [ RootRelativeFilter ], { :base_url => 'http://somehost.com' }
198198
199199## Instrumenting
200200
201- To instrument each filter and a full pipeline call, set an
202- [ ActiveSupport::Notifications] ( http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html )
203- service object on a pipeline object. New pipeline objects will default to the
201+ Filters and Pipelines can be set up to be instrumented when called. The pipeline
202+ must be setup with an [ ActiveSupport::Notifications]
203+ (http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html )
204+ compatible service object and a name. New pipeline objects will default to the
204205` HTML::Pipeline.default_instrumentation_service ` object.
205206
206207``` ruby
@@ -209,10 +210,12 @@ service = ActiveSupport::Notifications
209210
210211# instrument a specific pipeline
211212pipeline = HTML ::Pipeline .new [MarkdownFilter ], context
212- pipeline.instrumentation_service = service
213+ pipeline.setup_instrumentation " MarkdownPipeline " , service
213214
214- # or instrument all new pipelines
215+ # or set default instrumentation service for all new pipelines
215216HTML ::Pipeline .default_instrumentation_service = service
217+ pipeline = HTML ::Pipeline .new [MarkdownFilter ], context
218+ pipeline.setup_instrumentation " MarkdownPipeline"
216219```
217220
218221Filters are instrumented when they are run through the pipeline. A
@@ -222,9 +225,8 @@ instrumentation call.
222225
223226``` ruby
224227service.subscribe " call_filter.html_pipeline" do |event , start , ending , transaction_id , payload |
225- payload[:pipeline ] # => "MarkdownPipeline"
228+ payload[:pipeline ] # => "MarkdownPipeline", set with `setup_instrumentation`
226229 payload[:filter ] # => "MarkdownFilter"
227- payload[:doc ] # => HTML String or Nokogiri::DocumentFragment
228230 payload[:context ] # => context Hash
229231 payload[:result ] # => instance of result class
230232 payload[:result ][:output ] # => output HTML String or Nokogiri::DocumentFragment
@@ -235,7 +237,7 @@ The full pipeline is also instrumented:
235237
236238``` ruby
237239service.subscribe " call_pipeline.html_pipeline" do |event , start , ending , transaction_id , payload |
238- payload[:pipeline ] # => "MarkdownPipeline"
240+ payload[:pipeline ] # => "MarkdownPipeline", set with `setup_instrumentation`
239241 payload[:filters ] # => ["MarkdownFilter"]
240242 payload[:doc ] # => HTML String or Nokogiri::DocumentFragment
241243 payload[:context ] # => context Hash
0 commit comments