Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Add notes about tracing activerecord

  • Loading branch information...
commit 4567415c84794eb19c9384623cc452dd2679f80c 1 parent 2f08b47
@jordansissel authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 README.textile
View
18 README.textile
@@ -51,6 +51,22 @@ exit String#reverse([])
dlrow olleH
</pre>
+h4. Example: Tracing puppet storeconfigs (aka Tracing ActiveRecord queries)
+
+ActiveRecord has a base class for most things query-related. Let's trace that:
+
+<pre>
+% sudo env RUBY_INSTRUMENT=ActiveRecord::ConnectionAdapters::DatabaseStatements minstrel puppet ...
+enter ActiveRecord::ConnectionAdapters::DatabaseStatements#select_all(["SELECT DISTINCT
+`hosts`.id FROM `hosts` LEFT OUTER JOIN `fact_values` ON `fact_values`.`host_id` = `h
+osts`.`id` LEFT OUTER JOIN `fact_names` ON `fact_names`.`id` = `fact_values`.`fact_name_id`
+...
+enter ActiveRecord::ConnectionAdapters::DatabaseStatements#select_all(["SELECT `hosts`.`id` AS t0_r0, `hosts`.`name` AS t0_r1, `hosts`.`ip` AS t0_r2, `hosts`.`environment ...
+</pre>
+
+So easy :)
+
+
h3. From ruby
Boilerplate:
@@ -118,3 +134,5 @@ Wrap of TCPSocket successful
Minstrel will wrap 'require' and check for classes you want wrapped at each
require until it finds all the classes you asked to be wrapped.
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.