Permalink
Browse files

No need to check for connection_ids since we are whitelisting.

  • Loading branch information...
1 parent e4d42d5 commit cd49ff6d6daef4b9a2e15e08810c8000e61e5035 @josevalim josevalim committed Feb 16, 2010
Showing with 1 addition and 16 deletions.
  1. +1 −8 lib/rails_metrics/orm/active_record.rb
  2. +0 −8 test/orm/active_record_test.rb
@@ -2,8 +2,7 @@
# or DELETE and queries made by the own store.
RailsMetrics.ignore :invalid_queries do |name, payload|
name == "active_record.sql" &&
- (payload[:sql] !~ /^(SELECT|INSERT|UPDATE|DELETE)/ ||
- RailsMetrics.store.connections_ids.include?(payload[:connection_id]))
+ payload[:sql] !~ /^(SELECT|INSERT|UPDATE|DELETE)/
end
module RailsMetrics
@@ -50,12 +49,6 @@ module ActiveRecord
scope :fastest, order("duration ASC")
end
- module ClassMethods
- def connections_ids
- self.connection_pool.connections.map(&:object_id)
- end
- end
-
protected
def save_metric!
@@ -5,14 +5,6 @@ class ActiveRecordTest < ActiveSupport::TestCase
Metric.delete_all
end
- test "does not store own queries as notifications" do
- instrument "test.event" do
- Metric.all
- end
- wait
- assert_equal 2, Metric.all.count # one for test.event and other for rack.request
- end
-
test "does not store queries other than SELECT, INSERT, UPDATE and DELETE" do
instrument "test.event" do
User.connection.send(:select, "SHOW tables;")

0 comments on commit cd49ff6

Please sign in to comment.