newrelic_rpm 3.9.3.241 → 3.9.4.245
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.gitignore +1 -0
- data/CHANGELOG +29 -0
- data/Rakefile +41 -0
- data/cert/cacert.pem +1176 -117
- data/lib/new_relic/agent/agent_logger.rb +14 -0
- data/lib/new_relic/agent/configuration/default_source.rb +88 -86
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -1
- data/lib/new_relic/agent/configuration/high_security_source.rb +3 -1
- data/lib/new_relic/agent/configuration/yaml_source.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +4 -0
- data/lib/new_relic/agent/method_tracer.rb +17 -2
- data/lib/new_relic/agent/new_relic_service.rb +21 -19
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +8 -2
- data/lib/new_relic/agent/request_sampler.rb +9 -11
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/config.html.erb +2 -2
- data/lib/tasks/config.rake +6 -6
- data/test/environments/lib/environments/runner.rb +4 -4
- data/test/environments/rails42/Gemfile +35 -0
- data/test/environments/rails42/Rakefile +11 -0
- data/test/environments/rails42/config/application.rb +18 -0
- data/test/environments/rails42/config/boot.rb +10 -0
- data/test/environments/rails42/config/database.yml +26 -0
- data/test/environments/rails42/config/environment.rb +6 -0
- data/test/environments/rails42/db/schema.rb +5 -0
- data/test/fixtures/cross_agent_tests/README.md +40 -1
- data/test/fixtures/cross_agent_tests/cat_map.json +305 -73
- data/test/fixtures/cross_agent_tests/sql_obfuscation/pathological/README.md +4 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{end_of_line_comments_with_quotes.obfuscated → pathological/end_of_line_comments_with_quotes.obfuscated} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{end_of_line_comments_with_quotes.sql → pathological/end_of_line_comments_with_quotes.sql} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_comments_and_quotes.obfuscated → pathological/mixed_comments_and_quotes.obfuscated} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_comments_and_quotes.sql → pathological/mixed_comments_and_quotes.sql} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_quotes_comments_and_newlines.obfuscated → pathological/mixed_quotes_comments_and_newlines.obfuscated} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_quotes_comments_and_newlines.sql → pathological/mixed_quotes_comments_and_newlines.sql} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_quotes_end_of_line_comments.obfuscated → pathological/mixed_quotes_end_of_line_comments.obfuscated} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{mixed_quotes_end_of_line_comments.sql → pathological/mixed_quotes_end_of_line_comments.sql} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{quote_delimiters_in_comments.obfuscated → pathological/quote_delimiters_in_comments.obfuscated} +0 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/{quote_delimiters_in_comments.sql → pathological/quote_delimiters_in_comments.sql} +0 -0
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +9 -4
- data/test/multiverse/suites/rails/Envfile +6 -0
- data/test/multiverse/suites/rails/ignore_test.rb +7 -7
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +13 -13
- data/test/new_relic/agent/configuration/environment_source_test.rb +8 -0
- data/test/new_relic/agent/configuration/yaml_source_test.rb +1 -1
- data/test/new_relic/agent/database/sql_obfuscation_test.rb +17 -8
- data/test/new_relic/agent/instrumentation/active_record_test.rb +50 -7
- data/test/new_relic/agent/new_relic_service_test.rb +17 -4
- data/test/new_relic/http_client_test_cases.rb +15 -5
- data/test/performance/lib/performance.rb +8 -0
- data/test/performance/lib/performance/baseline.rb +36 -0
- data/test/performance/lib/performance/baseline_compare_reporter.rb +82 -0
- data/test/performance/lib/performance/baseline_save_reporter.rb +24 -0
- data/test/performance/lib/performance/console_reporter.rb +7 -20
- data/test/performance/lib/performance/reporting.rb +36 -0
- data/test/performance/lib/performance/table.rb +105 -0
- data/test/performance/script/runner +26 -20
- data/test/performance/suites/marshalling.rb +12 -12
- data/test/script/path_hash.rb +1 -1
- metadata +25 -25
- metadata.gz.sig +0 -0
- data/cert/oldsite.pem +0 -28
- data/cert/site.pem +0 -27
- data/test/flaky_proxy/Gemfile +0 -3
- data/test/flaky_proxy/README.md +0 -140
- data/test/flaky_proxy/lib/flaky_proxy.rb +0 -23
- data/test/flaky_proxy/lib/flaky_proxy/connection.rb +0 -45
- data/test/flaky_proxy/lib/flaky_proxy/http_message.rb +0 -107
- data/test/flaky_proxy/lib/flaky_proxy/proxy.rb +0 -58
- data/test/flaky_proxy/lib/flaky_proxy/rule.rb +0 -72
- data/test/flaky_proxy/lib/flaky_proxy/rule_set.rb +0 -45
- data/test/flaky_proxy/lib/flaky_proxy/sequence.rb +0 -14
- data/test/flaky_proxy/lib/flaky_proxy/server.rb +0 -22
- data/test/flaky_proxy/script/flaky_proxy +0 -39
@@ -1,58 +0,0 @@
|
|
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
|
-
require 'socket'
|
6
|
-
|
7
|
-
module FlakyProxy
|
8
|
-
class Proxy
|
9
|
-
def initialize(options)
|
10
|
-
@listen_host = options.fetch(:listen_host)
|
11
|
-
@listen_port = options.fetch(:listen_port)
|
12
|
-
@backend_server = Server.new(options.fetch(:target_host), options.fetch(:target_port))
|
13
|
-
@rules = RuleSet.build('')
|
14
|
-
@rules_path = options[:rules_path]
|
15
|
-
@listen_socket = nil
|
16
|
-
reload_rules_file
|
17
|
-
end
|
18
|
-
|
19
|
-
def service_connection(client_socket)
|
20
|
-
with_connection_logging(client_socket) do
|
21
|
-
Connection.new(client_socket, @backend_server, @rules).service
|
22
|
-
end
|
23
|
-
rescue => e
|
24
|
-
FlakyProxy.logger.error("Error servicing connection: #{e}, from #{e.backtrace.join("\n")}")
|
25
|
-
end
|
26
|
-
|
27
|
-
def reload_rules_file
|
28
|
-
if @rules_path
|
29
|
-
mtime = File.stat(@rules_path).mtime
|
30
|
-
if @last_rules_mtime.nil? || mtime > @last_rules_mtime
|
31
|
-
FlakyProxy.logger.info("Reloading rules file at #{@rules_path}")
|
32
|
-
@rules = RuleSet.build(File.read(@rules_path))
|
33
|
-
@last_rules_mtime = mtime
|
34
|
-
end
|
35
|
-
end
|
36
|
-
rescue => e
|
37
|
-
FlakyProxy.logger.error("Error reloading rules file at #{@rules_path}: #{e}\n#{e.backtrace.join("\n")}")
|
38
|
-
end
|
39
|
-
|
40
|
-
def with_connection_logging(client_socket)
|
41
|
-
peer_info = client_socket.peeraddr(:hostname)
|
42
|
-
client_str = "#{peer_info[2]}:#{peer_info[1]}"
|
43
|
-
FlakyProxy.logger.info("Accepted connection from #{client_str}")
|
44
|
-
yield
|
45
|
-
FlakyProxy.logger.info("Finished servicing connection from #{client_str}")
|
46
|
-
end
|
47
|
-
|
48
|
-
def run
|
49
|
-
FlakyProxy.logger.info("Starting FlakyProxy on #{@listen_host}:#{@listen_port} -> #{@backend_server.to_s}")
|
50
|
-
@listen_socket = TCPServer.new(@listen_host, @listen_port)
|
51
|
-
loop do
|
52
|
-
client_socket = @listen_socket.accept
|
53
|
-
service_connection(client_socket)
|
54
|
-
reload_rules_file
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,72 +0,0 @@
|
|
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
|
-
module FlakyProxy
|
6
|
-
class Rule
|
7
|
-
class ActionBuilder
|
8
|
-
attr_reader :actions
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@actions = []
|
12
|
-
end
|
13
|
-
|
14
|
-
def pass
|
15
|
-
@actions << [:pass]
|
16
|
-
end
|
17
|
-
|
18
|
-
def respond(response_spec)
|
19
|
-
@actions << [:respond, response_spec]
|
20
|
-
end
|
21
|
-
|
22
|
-
def delay(amount)
|
23
|
-
@actions << [:delay, amount]
|
24
|
-
end
|
25
|
-
|
26
|
-
def close
|
27
|
-
@actions << [:close]
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def initialize(url_regex=nil, builder=nil, &blk)
|
32
|
-
@url_regex = url_regex
|
33
|
-
@action = blk
|
34
|
-
@builder = builder || ActionBuilder.new
|
35
|
-
@default_action = [:pass]
|
36
|
-
end
|
37
|
-
|
38
|
-
def match?(request)
|
39
|
-
@url_regex.nil? || @url_regex.match(request.request_url)
|
40
|
-
end
|
41
|
-
|
42
|
-
def next_action
|
43
|
-
@builder.actions.shift || @default_action
|
44
|
-
end
|
45
|
-
|
46
|
-
def relay(request, connection)
|
47
|
-
request.relay_to(connection.server_socket)
|
48
|
-
response = Response.read_from(connection.server_socket)
|
49
|
-
response.relay_to(connection.client_socket)
|
50
|
-
end
|
51
|
-
|
52
|
-
def evaluate(request, connection)
|
53
|
-
@builder.instance_exec(request, connection, &@action) if @action
|
54
|
-
action, *params = next_action
|
55
|
-
FlakyProxy.logger.info(" [#{action.upcase}] #{request.request_method} #{request.request_url}")
|
56
|
-
case action
|
57
|
-
when :pass
|
58
|
-
relay(request, connection)
|
59
|
-
when :respond
|
60
|
-
response_spec = params.first
|
61
|
-
response = Response.build(response_spec)
|
62
|
-
response.relay_to(connection.client_socket)
|
63
|
-
when :delay
|
64
|
-
amount = params.first
|
65
|
-
sleep(amount)
|
66
|
-
relay(request, connection)
|
67
|
-
when :close
|
68
|
-
connection.client_socket.close
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,45 +0,0 @@
|
|
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
|
-
module FlakyProxy
|
6
|
-
class RuleSet
|
7
|
-
class Builder
|
8
|
-
attr_reader :rules
|
9
|
-
|
10
|
-
def initialize(ruleset, &blk)
|
11
|
-
@ruleset = ruleset
|
12
|
-
@rules = []
|
13
|
-
end
|
14
|
-
|
15
|
-
def match(criteria, sequence=nil, &blk)
|
16
|
-
if blk
|
17
|
-
@ruleset.rules << Rule.new(criteria, &blk)
|
18
|
-
else
|
19
|
-
@ruleset.rules << Rule.new(criteria, sequence.builder)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def sequence(&blk)
|
24
|
-
Sequence.new(&blk)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.build(text=nil, &blk)
|
29
|
-
ruleset = self.new
|
30
|
-
Builder.new(ruleset).instance_eval(text, &blk)
|
31
|
-
ruleset
|
32
|
-
end
|
33
|
-
|
34
|
-
attr_accessor :rules
|
35
|
-
|
36
|
-
def initialize
|
37
|
-
@rules = []
|
38
|
-
@default_rule = Rule.new { pass }
|
39
|
-
end
|
40
|
-
|
41
|
-
def match(request)
|
42
|
-
@rules.detect { |rule| rule.match?(request) } || @default_rule
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,14 +0,0 @@
|
|
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
|
-
module FlakyProxy
|
6
|
-
class Sequence
|
7
|
-
attr_reader :builder
|
8
|
-
|
9
|
-
def initialize(&blk)
|
10
|
-
@builder = Rule::ActionBuilder.new
|
11
|
-
@builder.instance_eval(&blk)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,22 +0,0 @@
|
|
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
|
-
module FlakyProxy
|
6
|
-
class Server
|
7
|
-
attr_reader :host, :port
|
8
|
-
|
9
|
-
def initialize(host, port)
|
10
|
-
@host = host
|
11
|
-
@port = port
|
12
|
-
end
|
13
|
-
|
14
|
-
def open_socket
|
15
|
-
TCPSocket.new(@host, @port)
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_s
|
19
|
-
"#{@host}:#{@port}"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'flaky_proxy')
|
5
|
-
|
6
|
-
DEFAULTS = {
|
7
|
-
:listen_host => 'localhost',
|
8
|
-
:listen_port => 8888,
|
9
|
-
:target_host => 'localhost',
|
10
|
-
:target_port => 8081
|
11
|
-
}
|
12
|
-
|
13
|
-
options = DEFAULTS.dup
|
14
|
-
parser = OptionParser.new do |opts|
|
15
|
-
opts.banner = "Usage: #{$0} [options] [<rules file>]"
|
16
|
-
|
17
|
-
opts.on("-l", "--listen [<HOST>:]<PORT>", "Specify the host and port to listen on") do |listen_spec|
|
18
|
-
if listen_spec =~ /^([^:]+):(\d+)$/
|
19
|
-
options[:listen_host] = $1
|
20
|
-
options[:listen_port] = $2.to_i
|
21
|
-
else
|
22
|
-
options[:listen_port] = listen_spec.to_i
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
opts.on("-t", "--target [<HOST>:]<PORT>", "Specify the host and port to forward to") do |target_spec|
|
27
|
-
if target_spec =~ /^([^:]+):(\d+)$/
|
28
|
-
options[:target_host] = $1
|
29
|
-
options[:target_port] = $2
|
30
|
-
else
|
31
|
-
options[:target_port] = target_spec.to_i
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
parser.parse!
|
36
|
-
|
37
|
-
options[:rules_path] = ARGV[0] if ARGV[0]
|
38
|
-
|
39
|
-
FlakyProxy::Proxy.new(options).run
|