Permalink
Browse files

[instrumentation guide] Add introduction + basic outline

  • Loading branch information...
1 parent 7dfa8c0 commit 4bfc8b1e2ceaa0f87fa9642b535f4dd8a2f7fd6f @radar radar committed Mar 5, 2012
Showing with 39 additions and 0 deletions.
  1. +39 −0 railties/guides/source/active_support_instrumentation.textile
@@ -0,0 +1,39 @@
+h2. Active Support Instrumentation
+
+Active Support is a part of core Rails that provides Ruby language extensions, utilities and other things. One of the things it includes is an instrumentation API that can be used inside an application to measure certain actions that occur within Ruby code, such as that inside a Rails application or the framework itself. It is not limited to Rails, however. It can be used independently in other Ruby scripts if it is so desired.
+
+In this guide, you will learn how to use the instrumentation API inside of ActiveSupport to measure events inside of Rails and other Ruby code. We cover:
+
+* What instrumentation can provide
+* The hooks inside the Rails framework for instrumentation
+* Adding a subscriber to a hook
+* Building a custom instrumentation implementation
+
+endprologue.
+
+h3. Introduction to instrumentation
+
+The instrumentation API provided by ActiveSupport allows developers to provide hooks which other developers may hook into. There are several of these within the Rails framework, as described below in <TODO: link to section detailing each hook point>. With this API, developers can choose to be notified when certain events occur inside their application or another piece of Ruby code.
+
+For example, there is a hook provided within Active Record that is called every time Active Record uses a SQL query on a database. This hook could be *subscribed* to, and used to track the number of queries during a certain action. There's another hook around the processing of an action of a controller. This could be used, for instance, to track how long a specific action has taken.
+
+You are even able to create your own events inside your application which you can later subscribe to.
+
+h3. Rails framework hooks
+
+h4. Action Mailer
+
+h4. Action Controller
+
+h4. Action View
+
+h4. Active Record
+
+h4. Active Resource
+
+h4. Active Support
+
+h3. Subscribing to an event
+
+h3. Creating custom events
+

0 comments on commit 4bfc8b1

Please sign in to comment.