Permalink
Browse files

Add Dash recipe for data_fabric

  • Loading branch information...
1 parent de95b1f commit a11b79bc0d96284e82d95ed2e217b899978d08cd @mperham mperham committed Feb 6, 2009
Showing with 20 additions and 0 deletions.
  1. +20 −0 lib/data_fabric/dash.rb
@@ -0,0 +1,20 @@
+# A data_fabric recipe for use with the FiveRuns Dash metrics service at
+# http://dash.fiveruns.com.
+#
+# Hook into your Rails application by adding the recipe in your
+# config/initializers/dash.rb, like so:
+#
+# require 'data_fabric/dash'
+# Fiveruns::Dash::Rails.start :production => 'your-token' do |config|
+# config.add_recipe :data_fabric, 'http://mikeperham.com'
+# end
+#
+raise ArgumentError, "The Dash recipe for DataFabric is only supported on ActiveRecord 2.2 and greater" if ActiveRecord::VERSION::STRING < '2.2.0'
+
+Fiveruns::Dash.register_recipe :data_fabric, 'http://mikeperham.com' do |recipe|
+ recipe.absolute :open_connections, 'Open Connections' do
+ ConnectionProxy.shard_pools.map do |pool|
+ pool.instance_variable_get(:@checked_out) || 0
+ end.sum
+ end
+end

0 comments on commit a11b79b

Please sign in to comment.