Sha256: 58349ab513a9c33bef4bc3a700512a1a916b58d8b717d00a1709d86ca4398624

Contents?: true

Size: 1.54 KB

Versions: 9

Compression:

Stored size: 1.54 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

class SqlObfuscationTests < Performance::TestCase
  def setup
    require 'new_relic/agent/database'
    @long_query  = NewRelic::Agent::Database::Statement.new("SELECT DISTINCT table0.* FROM `table0` INNER JOIN `table1` ON `table1`.`metric_id` = `table0`.`id` LEFT JOIN `table3` ON table3.id_column = table0.id_column AND table3.metric_id = table0.id WHERE `table1`.`other_id` IN (92776, 49992, 61710, 84911, 90744, 40647) AND `table0`.`id_column` = 81067 AND `table0`.`col12` = '' AND ((table0.id_column=81067 )) AND ((table3.timestamp IS NULL OR table3.timestamp > 1406810459)) AND (((table0.name LIKE 'WebTransaction/%') OR ((table0.name LIKE 'OtherTransaction/%/%') AND (table0.name NOT LIKE '%/all')))) LIMIT 2250")
    @short_query = NewRelic::Agent::Database::Statement.new("SELECT * FROM `table` WHERE id=2540250 AND name LIKE 'OtherTransaction/%/%'")

    @long_query_pg = @long_query.dup
    @long_query_pg.adapter = 'postgresql'
    @short_query_pg = @short_query.dup
    @short_query_pg.adapter = 'postgresql'
  end

  def test_obfuscate_sql
    iterations.times do
      NewRelic::Agent::Database.obfuscate_sql(@long_query)
      NewRelic::Agent::Database.obfuscate_sql(@short_query)
    end
  end

  def test_obfuscate_sql_postgres
    iterations.times do
      NewRelic::Agent::Database.obfuscate_sql(@long_query_pg)
      NewRelic::Agent::Database.obfuscate_sql(@short_query_pg)
    end    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
newrelic_rpm-3.10.0.279 test/performance/suites/sql_obfuscation.rb
newrelic_rpm-3.9.9.275 test/performance/suites/sql_obfuscation.rb
newrelic_rpm-3.9.8.273 test/performance/suites/sql_obfuscation.rb
newrelic_rpm-3.9.7.266 test/performance/suites/sql_obfuscation.rb
newrelic_rpm-3.9.6.257 test/performance/suites/sql_obfuscation.rb
newrelic_rpm-3.9.5.251 test/performance/suites/sql_obfuscation.rb
newrelic_rpm-3.9.4.245 test/performance/suites/sql_obfuscation.rb
newrelic_rpm-3.9.3.241 test/performance/suites/sql_obfuscation.rb
newrelic_rpm-3.9.2.239 test/performance/suites/sql_obfuscation.rb