newrelic_rpm 3.14.2.312 → 3.14.3.313

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -5
  3. data/CHANGELOG +22 -0
  4. data/lib/new_relic/agent/agent.rb +0 -4
  5. data/lib/new_relic/agent/configuration/default_source.rb +114 -107
  6. data/lib/new_relic/agent/database.rb +17 -1
  7. data/lib/new_relic/agent/database/obfuscation_helpers.rb +68 -48
  8. data/lib/new_relic/agent/database/obfuscator.rb +4 -23
  9. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
  10. data/lib/new_relic/agent/instrumentation/data_mapper.rb +20 -1
  11. data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +1 -1
  12. data/lib/new_relic/agent/rules_engine.rb +39 -2
  13. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +27 -5
  14. data/lib/new_relic/agent/sql_sampler.rb +7 -3
  15. data/lib/new_relic/language_support.rb +8 -0
  16. data/lib/new_relic/version.rb +1 -1
  17. data/lib/tasks/config.html.erb +5 -1
  18. data/lib/tasks/config.rake +10 -2
  19. data/lib/tasks/config.text.erb +6 -5
  20. data/test/environments/rails32/Gemfile +6 -1
  21. data/test/fixtures/cross_agent_tests/aws.json +95 -1
  22. data/test/fixtures/cross_agent_tests/cat/README.md +28 -0
  23. data/test/fixtures/cross_agent_tests/cat/cat_map.json +595 -0
  24. data/test/fixtures/cross_agent_tests/cat/path_hashing.json +51 -0
  25. data/test/fixtures/cross_agent_tests/data_transport/data_transport.json +1441 -0
  26. data/test/fixtures/cross_agent_tests/data_transport/data_transport.md +35 -0
  27. data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +7 -2
  28. data/test/fixtures/cross_agent_tests/sql_obfuscation/sql_obfuscation.json +261 -35
  29. data/test/fixtures/cross_agent_tests/transaction_segment_terms.json +305 -17
  30. data/test/multiverse/suites/active_record/active_record_test.rb +1 -1
  31. data/test/multiverse/suites/agent_only/rename_rule_test.rb +12 -12
  32. data/test/multiverse/suites/datamapper/datamapper_test.rb +23 -0
  33. data/test/multiverse/suites/rails/Envfile +10 -2
  34. data/test/new_relic/agent/database/sql_obfuscation_test.rb +2 -7
  35. data/test/performance/README.md +3 -10
  36. data/test/performance/lib/performance/table.rb +1 -1
  37. data/test/performance/suites/rules_engine.rb +35 -0
  38. data/test/performance/suites/segment_terms_rule.rb +27 -0
  39. data/test/performance/suites/sql_obfuscation.rb +19 -0
  40. metadata +9 -2
@@ -22,7 +22,11 @@ if RUBY_VERSION >= '1.9.3'
22
22
  end
23
23
 
24
24
  gemfile <<-RB
25
- gem 'rails', '~>3.2.20'
25
+ if RUBY_VERSION < '1.9.3' # Rails 3.2.22.1 is incompatible with MRI 1.8.7 / ree
26
+ gem 'rails', '3.2.22'
27
+ else
28
+ gem 'rails', '~>3.2.20'
29
+ end
26
30
  gem 'i18n', '~>0.6.11'
27
31
  gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
28
32
  gem 'minitest_tu_shim', :require => false
@@ -30,7 +34,11 @@ gemfile <<-RB
30
34
  RB
31
35
 
32
36
  gemfile <<-RB
33
- gem 'rails', '~>3.2.20'
37
+ if RUBY_VERSION < '1.9.3' # Rails 3.2.22.1 is incompatible with MRI 1.8.7 / ree
38
+ gem 'rails', '3.2.22'
39
+ else
40
+ gem 'rails', '~>3.2.20'
41
+ end
34
42
  gem 'i18n', '~>0.6.11'
35
43
  gem 'sinatra', '~> 1.4.5'
36
44
  gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
@@ -6,20 +6,15 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'te
6
6
 
7
7
  module NewRelic::Agent::Database
8
8
  class SqlObfuscationTest < Minitest::Test
9
- DIALECT_MAP = {
10
- 'postgres' => :postgresql,
11
- 'mysql' => :mysql
12
- }
13
-
14
9
  def self.create_input_statements(raw_query, dialects)
15
10
  dialects.map do |dialect|
16
- NewRelic::Agent::Database::Statement.new(raw_query, {:adapter => DIALECT_MAP[dialect]})
11
+ NewRelic::Agent::Database::Statement.new(raw_query, {:adapter => dialect})
17
12
  end
18
13
  end
19
14
 
20
15
  def build_failure_message(statement, acceptable_outputs, actual_output)
21
16
  msg = "Failed to obfuscate #{statement.adapter} query correctly.\n"
22
- msg << "Input: #{statement.to_s}\n"
17
+ msg << "Input: #{statement.inspect}\n"
23
18
  if acceptable_outputs.size == 1
24
19
  msg << "Expected: #{acceptable_outputs.first}\n"
25
20
  else
@@ -104,13 +104,6 @@ by specifying the path to the agent you want to test against by passing the `-A`
104
104
  flag to the `runner` script, or by setting the `AGENT_PATH` environment variable
105
105
  when using the rake task.
106
106
 
107
- ## Sending results to Hako
108
-
109
- This is currently considered experimental, but you can send results
110
- automatically to Hako by passing `-R HakoReporter` on the command line to the
111
- `runner`. This will produce JSON-formatted versions of each test result, and
112
- submit them to Hako. You will need to set the `HAKO_TOKEN` environment variable
113
- to a valid Hako access token when doing this.
114
107
 
115
108
  ## Writing tests
116
109
 
@@ -146,10 +139,10 @@ compatibility with JRuby.
146
139
  Additionally, when operating in this mode, the `newrelic_rpm` gem will not be
147
140
  loaded until *after* the fork call. This means that your **test cases must be
148
141
  loadable (though not necessarily runnable) without the `newrelic_rpm` gem
149
- avaiable**.
142
+ available**.
150
143
 
151
144
  Not all command-line options to the runner work with this test isolation yet.
152
- You can disable it by passing the `-I/--inline` flag to the runner.
145
+ You can disable it by passing the `-I` or `--inline` flag to the runner.
153
146
 
154
147
  ## Adding instrumentation layers
155
148
 
@@ -164,7 +157,7 @@ Instrumentors inherit from `Performance::Instrumentation::Instrumentor`, and may
164
157
  constrain themselves to running only on certain platforms (see `instrumentor.rb`
165
158
  for a list) by calling the `platforms` method in their class definitions. They
166
159
  may also signal that they should be used by default by calling `on_by_default`.
167
- They should imlement the `before`, `after` and `results` methods as follows:
160
+ They should implement the `before`, `after` and `results` methods as follows:
168
161
 
169
162
  The `before` method is called before each test is run. The test class and test
170
163
  name are passed as arguments.
@@ -61,7 +61,7 @@ module Performance
61
61
  def column_widths
62
62
  widths = Array.new(@schema.size, 0)
63
63
  @schema.each_with_index do |col, idx|
64
- widths[idx] = col.name.size
64
+ widths[idx] = col.name.to_s.size
65
65
  end
66
66
  @rows.each do |row|
67
67
  row.each_with_index do |cell, idx|
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ class RulesEngineTests < Performance::TestCase
6
+ def setup
7
+ @basic_rule_specs = {
8
+ "transaction_segment_terms": [
9
+ {
10
+ "prefix": "WebTransaction/Custom",
11
+ "terms": ["one", "two", "three"]
12
+ },
13
+ {
14
+ "prefix": "WebTransaction/Uri",
15
+ "terms": ["seven", "eight", "nine"]
16
+ }
17
+ ]
18
+ }
19
+ end
20
+
21
+ def test_rules_engine_init_transaction_rules
22
+ measure do
23
+ NewRelic::Agent::RulesEngine.create_transaction_rules(@basic_rule_specs)
24
+ end
25
+ end
26
+
27
+ def test_rules_engine_rename_transaction_rules
28
+ measure do
29
+ rules_engine = NewRelic::Agent::RulesEngine.create_transaction_rules(@basic_rule_specs)
30
+ rules_engine.rename "WebTransaction/Uri/one/two/seven/user/nine/account"
31
+ rules_engine.rename "WebTransaction/Custom/one/two/seven/user/nine/account"
32
+ rules_engine.rename "WebTransaction/Other/one/two/foo/bar"
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ class SegmentTermsRuleTests < Performance::TestCase
6
+ def setup
7
+
8
+ end
9
+
10
+ def test_segment_terms_rule_matches?
11
+ measure do
12
+ NewRelic::Agent::RulesEngine::SegmentTermsRule.new({
13
+ 'prefix' => 'foo/bar/',
14
+ 'terms' => []
15
+ }).matches?('foo/bar')
16
+ end
17
+ end
18
+
19
+ def test_segment_terms_rule_apply
20
+ measure do
21
+ NewRelic::Agent::RulesEngine::SegmentTermsRule.new({
22
+ 'prefix' => 'foo/bar/',
23
+ 'terms' => []
24
+ }).apply('foo/bar/baz/qux')
25
+ end
26
+ end
27
+ end
@@ -28,4 +28,23 @@ class SqlObfuscationTests < Performance::TestCase
28
28
  NewRelic::Agent::Database.obfuscate_sql(@short_query_pg)
29
29
  end
30
30
  end
31
+
32
+ def test_obfuscate_cross_agent_tests
33
+ test_cases = load_cross_agent_test('sql_obfuscation/sql_obfuscation')
34
+ statements = []
35
+
36
+ test_cases.each do |test_case|
37
+ query = test_case['sql']
38
+
39
+ test_case['dialects'].map do |dialect|
40
+ statements << NewRelic::Agent::Database::Statement.new(query, {:adapter => dialect})
41
+ end
42
+ end
43
+
44
+ measure do
45
+ statements.each do |statement|
46
+ NewRelic::Agent::Database.obfuscate_sql(statement)
47
+ end
48
+ end
49
+ end
31
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.2.312
4
+ version: 3.14.3.313
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Krajcar
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-01-13 00:00:00.000000000 Z
14
+ date: 2016-02-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -566,7 +566,12 @@ files:
566
566
  - test/fixtures/cross_agent_tests/README.md
567
567
  - test/fixtures/cross_agent_tests/attribute_configuration.json
568
568
  - test/fixtures/cross_agent_tests/aws.json
569
+ - test/fixtures/cross_agent_tests/cat/README.md
570
+ - test/fixtures/cross_agent_tests/cat/cat_map.json
571
+ - test/fixtures/cross_agent_tests/cat/path_hashing.json
569
572
  - test/fixtures/cross_agent_tests/cat_map.json
573
+ - test/fixtures/cross_agent_tests/data_transport/data_transport.json
574
+ - test/fixtures/cross_agent_tests/data_transport/data_transport.md
570
575
  - test/fixtures/cross_agent_tests/docker_container_id/README.md
571
576
  - test/fixtures/cross_agent_tests/docker_container_id/cases.json
572
577
  - test/fixtures/cross_agent_tests/docker_container_id/docker-0.9.1.txt
@@ -1202,7 +1207,9 @@ files:
1202
1207
  - test/performance/suites/queue_time.rb
1203
1208
  - test/performance/suites/rack_middleware.rb
1204
1209
  - test/performance/suites/redis.rb
1210
+ - test/performance/suites/rules_engine.rb
1205
1211
  - test/performance/suites/rum_autoinsertion.rb
1212
+ - test/performance/suites/segment_terms_rule.rb
1206
1213
  - test/performance/suites/sql_obfuscation.rb
1207
1214
  - test/performance/suites/startup.rb
1208
1215
  - test/performance/suites/stats_hash.rb