newrelic_rpm 3.14.1.311 → 3.14.2.312
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +174 -11
- data/CHANGELOG +22 -0
- data/Rakefile +5 -0
- data/lib/new_relic/agent/agent.rb +22 -7
- data/lib/new_relic/agent/aws_info.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +19 -44
- data/lib/new_relic/agent/error_event_aggregator.rb +11 -103
- data/lib/new_relic/agent/event_aggregator.rb +130 -0
- data/lib/new_relic/agent/event_buffer.rb +7 -0
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +18 -2
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +12 -4
- data/lib/new_relic/agent/new_relic_service.rb +6 -4
- data/lib/new_relic/agent/sampled_buffer.rb +9 -6
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +1 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +2 -1
- data/lib/new_relic/agent/supported_versions.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +52 -0
- data/lib/new_relic/agent/synthetics_event_buffer.rb +0 -2
- data/lib/new_relic/agent/transaction.rb +14 -7
- data/lib/new_relic/agent/transaction/request_attributes.rb +7 -2
- data/lib/new_relic/agent/transaction_error_primitive.rb +72 -0
- data/lib/new_relic/agent/transaction_event_aggregator.rb +33 -210
- data/lib/new_relic/agent/transaction_event_primitive.rb +106 -0
- data/lib/new_relic/agent/transaction_event_recorder.rb +48 -0
- data/lib/new_relic/agent/transaction_metrics.rb +9 -1
- data/lib/new_relic/agent/transction_event_recorder.rb +35 -0
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/versions.html.erb +13 -11
- data/lib/tasks/versions.postface.html +8 -0
- data/lib/tasks/versions.preface.html +3 -0
- data/lib/tasks/versions.rake +15 -5
- data/test/agent_helper.rb +1 -1
- data/test/environments/rails31/Gemfile +2 -0
- data/test/environments/rails32/Gemfile +2 -0
- data/test/environments/rails32/Rakefile +2 -1
- data/test/environments/rails32/config/database.yml +1 -6
- data/test/multiverse/suites/active_record/Envfile +1 -0
- data/test/multiverse/suites/agent_only/agent_attributes_test.rb +18 -0
- data/test/multiverse/suites/agent_only/custom_analytics_events_test.rb +21 -6
- data/test/multiverse/suites/agent_only/error_events_test.rb +14 -6
- data/test/multiverse/suites/agent_only/transaction_events_test.rb +31 -0
- data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +2 -0
- data/test/multiverse/suites/capistrano/Envfile +9 -3
- data/test/multiverse/suites/capistrano2/Envfile +4 -0
- data/test/multiverse/suites/config_file_loading/Envfile +1 -1
- data/test/multiverse/suites/curb/Envfile +1 -1
- data/test/multiverse/suites/datamapper/Envfile +3 -0
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +7 -3
- data/test/multiverse/suites/grape/grape_test.rb +2 -0
- data/test/multiverse/suites/padrino/Envfile +4 -3
- data/test/multiverse/suites/padrino/config/newrelic.yml +2 -0
- data/test/multiverse/suites/rack/config/newrelic.yml +18 -0
- data/test/multiverse/suites/rack/nested_non_rack_app_test.rb +1 -1
- data/test/multiverse/suites/rack/puma_rack_builder_test.rb +17 -14
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +16 -13
- data/test/multiverse/suites/rack/rack_unsupported_version_test.rb +1 -1
- data/test/multiverse/suites/rails/Envfile +5 -0
- data/test/multiverse/suites/rails/parameter_capture_test.rb +9 -0
- data/test/multiverse/suites/rake/Envfile +2 -1
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sidekiq/Envfile +18 -0
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +11 -10
- data/test/multiverse/suites/sidekiq/test_model.rb +12 -0
- data/test/multiverse/suites/sinatra/ignoring_test.rb +43 -25
- data/test/multiverse/suites/sinatra/nested_middleware_test.rb +10 -2
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +4 -0
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +8 -2
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +4 -0
- data/test/multiverse/suites/sinatra/sinatra_parameter_capture_test.rb +2 -0
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +79 -10
- data/test/new_relic/agent/agent_test.rb +3 -3
- data/test/new_relic/agent/aws_info_test.rb +1 -2
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +2 -0
- data/test/new_relic/agent/custom_event_aggregator_test.rb +43 -4
- data/test/new_relic/agent/error_collector_test.rb +1 -1
- data/test/new_relic/agent/error_event_aggregator_test.rb +13 -81
- data/test/new_relic/agent/event_aggregator_test.rb +178 -0
- data/test/new_relic/agent/event_buffer_test_cases.rb +16 -0
- data/test/new_relic/agent/instrumentation/sinatra/transaction_namer_test.rb +7 -0
- data/test/new_relic/agent/new_relic_service_test.rb +7 -1
- data/test/new_relic/agent/pipe_channel_manager_test.rb +45 -3
- data/test/new_relic/agent/rpm_agent_test.rb +1 -0
- data/test/new_relic/agent/stats_engine/stats_hash_test.rb +2 -2
- data/test/new_relic/agent/synthetics_event_aggregator_test.rb +179 -0
- data/test/new_relic/agent/transaction/request_attributes_test.rb +8 -0
- data/test/new_relic/agent/transaction_error_primitive_test.rb +117 -0
- data/test/new_relic/agent/transaction_event_aggregator_test.rb +148 -374
- data/test/new_relic/agent/transaction_event_primitive_test.rb +195 -0
- data/test/new_relic/agent/transaction_event_recorder_test.rb +80 -0
- data/test/new_relic/agent/transaction_metrics_test.rb +7 -7
- data/test/new_relic/agent/transaction_test.rb +4 -4
- data/test/new_relic/agent/utilization_data_test.rb +7 -7
- data/test/new_relic/fake_collector.rb +10 -17
- data/test/new_relic/license_test.rb +2 -0
- data/test/new_relic/marshalling_test_cases.rb +1 -1
- data/test/nullverse/default_source_require_test.rb +21 -0
- data/test/nullverse/nullverse_helper.rb +10 -0
- data/test/performance/suites/active_record.rb +1 -1
- data/test/performance/suites/sql_obfuscation.rb +7 -6
- data/test/script/ci.sh +10 -165
- data/test/script/install_mongodb.sh +6 -0
- metadata +21 -6
- data/test/script/build_test_gem.sh +0 -57
- data/test/script/ci_agent-tests_runner.sh +0 -82
- data/test/script/ci_bench.sh +0 -52
- data/test/script/ci_multiverse_runner.sh +0 -63
@@ -0,0 +1,48 @@
|
|
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
|
+
require 'new_relic/agent/transaction_event_aggregator'
|
5
|
+
require 'new_relic/agent/synthetics_event_aggregator'
|
6
|
+
require 'new_relic/agent/transaction_event_primitive'
|
7
|
+
|
8
|
+
module NewRelic
|
9
|
+
module Agent
|
10
|
+
# This is responsibile for recording transaction events and managing
|
11
|
+
# the relationship between events generated from synthetics requests
|
12
|
+
# vs normal requests.
|
13
|
+
class TransactionEventRecorder
|
14
|
+
attr_reader :transaction_event_aggregator
|
15
|
+
attr_reader :synthetics_event_aggregator
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new
|
19
|
+
@synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def record payload
|
23
|
+
return unless NewRelic::Agent.config[:'analytics_events.enabled']
|
24
|
+
|
25
|
+
if synthetics_event? payload
|
26
|
+
event = create_event payload
|
27
|
+
_, rejected = synthetics_event_aggregator.append_or_reject event
|
28
|
+
transaction_event_aggregator.append event if rejected
|
29
|
+
else
|
30
|
+
transaction_event_aggregator.append { create_event(payload) }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_event payload
|
35
|
+
TransactionEventPrimitive.create payload
|
36
|
+
end
|
37
|
+
|
38
|
+
def synthetics_event? payload
|
39
|
+
payload.key? :synthetics_resource_id
|
40
|
+
end
|
41
|
+
|
42
|
+
def drop_buffered_data
|
43
|
+
transaction_event_aggregator.reset!
|
44
|
+
synthetics_event_aggregator.reset!
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -17,7 +17,15 @@ module NewRelic
|
|
17
17
|
@scoped = Hash.new(&DEFAULT_PROC)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
# As a general rule, when recording a scoped metric, the corresponding
|
21
|
+
# unscoped metric should always be recorded as well.
|
22
|
+
#
|
23
|
+
# As an optimization, scoped metrics are representated within this class
|
24
|
+
# only by their entries in the @scoped Hash, and it's up to clients to
|
25
|
+
# propagate them into unscoped metrics as well when instances of this
|
26
|
+
# class are merged into the global metric store.
|
27
|
+
#
|
28
|
+
def record_scoped_and_unscoped(names, value=nil, aux=nil, &blk)
|
21
29
|
_record_metrics(names, value, aux, @scoped, &blk)
|
22
30
|
end
|
23
31
|
|
@@ -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
|
+
require 'new_relic/agent/transaction_event_aggregator'
|
5
|
+
require 'new_relic/agent/synthetics_event_aggregator'
|
6
|
+
|
7
|
+
module NewRelic
|
8
|
+
module Agent
|
9
|
+
# This is responsibile for recording transaction events and managing
|
10
|
+
# the relationship between events generated from synthetics requests
|
11
|
+
# vs normal requests.
|
12
|
+
class TransactionEventRecorder
|
13
|
+
attr_reader :transaction_event_aggregator
|
14
|
+
attr_reader :synthetics_event_aggregator
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new
|
18
|
+
@synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def record payload
|
22
|
+
return unless NewRelic::Agent.config[:'analytics_events.enabled']
|
23
|
+
|
24
|
+
event = TransactionEvent.new payload
|
25
|
+
|
26
|
+
if event.synthetics?
|
27
|
+
_, rejected = synthetics_event_aggregator.append_or_reject event.to_collector_array
|
28
|
+
transaction_event_aggregator.record event if rejected
|
29
|
+
else
|
30
|
+
transaction_event_aggregator.record event.to_collector_array
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -10,7 +10,7 @@ namespace :newrelic do
|
|
10
10
|
desc "Record a deployment in New Relic (newrelic.com)"
|
11
11
|
task :notice_deployment do
|
12
12
|
run_locally do
|
13
|
-
environment = fetch(:newrelic_rails_env, fetch(:rack_env, fetch(:rails_env, "production")))
|
13
|
+
environment = fetch(:newrelic_rails_env, fetch(:rack_env, fetch(:rails_env, fetch(:stage, "production"))))
|
14
14
|
|
15
15
|
require 'new_relic/cli/command.rb'
|
16
16
|
|
data/lib/new_relic/version.rb
CHANGED
data/lib/tasks/versions.html.erb
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
<h2 id="<%= anchor %>"><%= title %></h2>
|
2
2
|
<table>
|
3
3
|
<thead>
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
<th>Supported</th>
|
7
|
+
<th>Deprecated</th>
|
8
|
+
<th>Experimental</th>
|
9
|
+
</tr>
|
8
10
|
</thead>
|
11
|
+
<tbody>
|
9
12
|
<% for version in versions %>
|
10
13
|
<tr>
|
11
14
|
<td><b><%= version.name %></b></td>
|
12
|
-
<td><%= version_list(version.supported) %></td>
|
13
|
-
<td><%= version_list(version.deprecated) %></td>
|
14
|
-
<td><%= version_list(version.experimental) %></td>
|
15
|
+
<td><%= CGI.escapeHTML(version_list(version.supported)) %></td>
|
16
|
+
<td><%= CGI.escapeHTML(version_list(version.deprecated)) %></td>
|
17
|
+
<td><%= CGI.escapeHTML(version_list(version.experimental)) %></td>
|
15
18
|
</tr>
|
16
19
|
<% if version.notes %>
|
17
20
|
<tr>
|
18
21
|
<td></td>
|
19
|
-
<td colspan=3>
|
20
|
-
|
21
|
-
<%= note %><br/>
|
22
|
-
<% end %>
|
22
|
+
<td colspan="3">
|
23
|
+
<%= version.notes.join("<br />") %>
|
23
24
|
</td>
|
24
25
|
</tr>
|
25
26
|
<% end %>
|
26
27
|
<% end %>
|
28
|
+
</tbody>
|
27
29
|
</table>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<h2 id="more_help">For more help</h2>
|
2
|
+
|
3
|
+
<p>Additional documentation resources include:
|
4
|
+
<ul>
|
5
|
+
<li><a href="/docs/agents/ruby-agent/getting-started/new-relic-ruby">New Relic for Ruby</a> (compatibility and requirements, general information about installation, configuration, troubleshooting, and known issues)</li>
|
6
|
+
<li><a href="/docs/agents/ruby-agent/installation-and-configuration/ruby-agent-installation">Ruby agent installation</a> (using the New Relic Ruby gem and configuration file)</li>
|
7
|
+
</ul>
|
8
|
+
</p>
|
data/lib/tasks/versions.rake
CHANGED
@@ -4,6 +4,7 @@ namespace :newrelic do
|
|
4
4
|
require File.join(File.dirname(__FILE__), '..', 'new_relic', 'agent', 'supported_versions')
|
5
5
|
|
6
6
|
task :supported_versions, [:format] => [] do |t, args|
|
7
|
+
require 'cgi'
|
7
8
|
|
8
9
|
def version_list(list)
|
9
10
|
return "-" if list.nil? || list.empty?
|
@@ -37,17 +38,26 @@ namespace :newrelic do
|
|
37
38
|
puts erb.result(binding).gsub(/^ *$/, '')
|
38
39
|
end
|
39
40
|
|
41
|
+
def include_if_exists(filename)
|
42
|
+
path = File.join(File.dirname(__FILE__), filename)
|
43
|
+
puts File.read(path) if File.exists?(path)
|
44
|
+
end
|
45
|
+
|
40
46
|
VersionStruct = Struct.new(:name, :supported, :deprecated, :experimental, :notes)
|
41
47
|
|
42
48
|
format = args[:format] || "txt"
|
43
49
|
erb = build_erb(format)
|
44
50
|
|
45
|
-
|
46
|
-
|
47
|
-
write_versions("
|
51
|
+
include_if_exists("versions.preface.#{format}")
|
52
|
+
|
53
|
+
write_versions("Ruby versions", :ruby, erb)
|
54
|
+
write_versions("Web servers", :app_server, erb)
|
55
|
+
write_versions("Web frameworks", :web, erb)
|
48
56
|
write_versions("Database", :database, erb)
|
49
|
-
write_versions("Background
|
50
|
-
write_versions("HTTP
|
57
|
+
write_versions("Background jobs", :background, erb)
|
58
|
+
write_versions("HTTP clients", :http, erb)
|
51
59
|
write_versions("Other", :other, erb)
|
60
|
+
|
61
|
+
include_if_exists("versions.postface.#{format}")
|
52
62
|
end
|
53
63
|
end
|
data/test/agent_helper.rb
CHANGED
@@ -604,7 +604,7 @@ def json_dump_and_encode(object)
|
|
604
604
|
end
|
605
605
|
|
606
606
|
def get_last_analytics_event
|
607
|
-
NewRelic::Agent.agent.
|
607
|
+
NewRelic::Agent.agent.transaction_event_aggregator.harvest![1].last
|
608
608
|
end
|
609
609
|
|
610
610
|
def swap_instance_method(target, method_name, new_method_implementation, &blk)
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# Shared properties for mysql db
|
2
1
|
mysql: &mysql
|
3
2
|
adapter: mysql
|
4
3
|
socket: <%= (`uname -s` =~ /Linux/ ) ? "" :"/tmp/mysql.sock" %>
|
@@ -6,8 +5,6 @@ mysql: &mysql
|
|
6
5
|
host: localhost
|
7
6
|
database: <%= db = "#{ENV['RUBY_VERSION']}#{ENV['BRANCH']}"; db.empty? ? "rails_blog" : db %>
|
8
7
|
|
9
|
-
# Shared properties for postgres. This won't work with our schema but
|
10
|
-
# Does work with agent tests
|
11
8
|
sqlite3: &sqlite3
|
12
9
|
<% if defined?(JRuby) %>
|
13
10
|
adapter: jdbcsqlite3
|
@@ -18,9 +15,7 @@ sqlite3: &sqlite3
|
|
18
15
|
pool: 5
|
19
16
|
timeout: 5000
|
20
17
|
host: localhost
|
21
|
-
|
22
|
-
# SQLite version 3.x
|
23
|
-
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
18
|
+
|
24
19
|
development:
|
25
20
|
<<: *sqlite3
|
26
21
|
|
@@ -32,6 +32,18 @@ class AgentAttributesTest < Minitest::Test
|
|
32
32
|
refute_browser_monitoring_has_agent_attribute("response.headers.contentType")
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_response_content_length_default_destinations
|
36
|
+
run_transaction do |txn|
|
37
|
+
txn.response_content_length = 100
|
38
|
+
end
|
39
|
+
|
40
|
+
assert_transaction_trace_has_agent_attribute("response.headers.contentLength", 100)
|
41
|
+
assert_event_has_agent_attribute("response.headers.contentLength", 100)
|
42
|
+
assert_error_has_agent_attribute("response.headers.contentLength", 100)
|
43
|
+
|
44
|
+
refute_browser_monitoring_has_agent_attribute("response.headers.contentLength")
|
45
|
+
end
|
46
|
+
|
35
47
|
def test_request_headers_referer_default_destinations
|
36
48
|
txn_options = {:request => stub(:referer => "referrer", :path => "/")}
|
37
49
|
run_transaction({}, txn_options) do |txn|
|
@@ -73,6 +85,7 @@ class AgentAttributesTest < Minitest::Test
|
|
73
85
|
:referer => "http://docs.newrelic.com",
|
74
86
|
:env => {"HTTP_ACCEPT" => "application/json"},
|
75
87
|
:content_length => 103,
|
88
|
+
:content_type => "application/json",
|
76
89
|
:host => 'chippy',
|
77
90
|
:user_agent => 'Use This!',
|
78
91
|
:request_method => "GET"
|
@@ -96,6 +109,11 @@ class AgentAttributesTest < Minitest::Test
|
|
96
109
|
assert_error_has_agent_attribute "request.headers.contentLength", 103
|
97
110
|
refute_browser_monitoring_has_agent_attribute "request.headers.contentLength"
|
98
111
|
|
112
|
+
assert_transaction_trace_has_agent_attribute "request.headers.contentType", "application/json"
|
113
|
+
assert_event_has_agent_attribute "request.headers.contentType", "application/json"
|
114
|
+
assert_error_has_agent_attribute "request.headers.contentType", "application/json"
|
115
|
+
refute_browser_monitoring_has_agent_attribute "request.headers.contentType"
|
116
|
+
|
99
117
|
assert_transaction_trace_has_agent_attribute "request.headers.host", "chippy"
|
100
118
|
assert_event_has_agent_attribute "request.headers.host", "chippy"
|
101
119
|
assert_error_has_agent_attribute "request.headers.host", "chippy"
|
@@ -12,7 +12,7 @@ class CustomAnalyticsEventsTest < Minitest::Test
|
|
12
12
|
NewRelic::Agent.record_custom_event(:DummyType, :foo => :bar, :baz => :qux)
|
13
13
|
|
14
14
|
NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
|
15
|
-
events =
|
15
|
+
events = last_posted_events
|
16
16
|
|
17
17
|
expected_event = [{'type' => 'DummyType', 'timestamp' => t0.to_i },
|
18
18
|
{'foo' => 'bar', 'baz' => 'qux'}]
|
@@ -37,7 +37,7 @@ class CustomAnalyticsEventsTest < Minitest::Test
|
|
37
37
|
NewRelic::Agent.record_custom_event(good_event_type, :foo => :bar)
|
38
38
|
|
39
39
|
NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
|
40
|
-
events =
|
40
|
+
events = last_posted_events
|
41
41
|
|
42
42
|
assert_equal(1, events.size)
|
43
43
|
assert_equal(good_event_type, events.first[0]['type'])
|
@@ -59,9 +59,24 @@ class CustomAnalyticsEventsTest < Minitest::Test
|
|
59
59
|
assert_equal(0, $collector.calls_for(:custom_event_data).size)
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
def test_post_includes_metadata
|
63
|
+
10.times do |i|
|
64
|
+
NewRelic::Agent.record_custom_event(:DummyType, :foo => :bar, :baz => :qux, :i => i)
|
65
|
+
end
|
66
|
+
|
67
|
+
NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
|
68
|
+
post = last_custom_event_post
|
69
|
+
|
70
|
+
assert_equal({"reservoir_size"=>1000, "events_seen"=>10}, post.reservoir_metadata)
|
71
|
+
end
|
72
|
+
|
73
|
+
def last_custom_event_post
|
74
|
+
posts = $collector.calls_for('custom_event_data')
|
75
|
+
assert_equal(1, posts.size)
|
76
|
+
posts.first
|
77
|
+
end
|
78
|
+
|
79
|
+
def last_posted_events
|
80
|
+
last_custom_event_post.events
|
66
81
|
end
|
67
82
|
end
|
@@ -52,18 +52,26 @@ class ErrorEventsTest < Minitest::Test
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_does_not_record_error_events_when_disabled_by_feature_gate
|
55
|
-
|
55
|
+
|
56
|
+
$collector.stub('connect', {
|
56
57
|
'agent_run_id' => 1,
|
57
58
|
'collect_error_events' => false
|
58
|
-
}
|
59
|
-
|
60
|
-
$collector.stub('connect', connect_response)
|
59
|
+
})
|
61
60
|
trigger_agent_reconnect
|
62
61
|
|
63
62
|
generate_errors 5
|
64
63
|
|
65
64
|
NewRelic::Agent.agent.send(:harvest_and_send_error_event_data)
|
66
65
|
assert_equal(0, $collector.calls_for(:error_event_data).size)
|
66
|
+
|
67
|
+
# reset the collect_error_events flag so that the ErrorEventAggregator
|
68
|
+
# will be enabled for the next test
|
69
|
+
$collector.stub('connect', {
|
70
|
+
'agent_run_id' => 1,
|
71
|
+
'collect_error_events' => true
|
72
|
+
})
|
73
|
+
|
74
|
+
trigger_agent_reconnect
|
67
75
|
end
|
68
76
|
|
69
77
|
def test_error_events_created_outside_of_transaction
|
@@ -86,8 +94,8 @@ class ErrorEventsTest < Minitest::Test
|
|
86
94
|
|
87
95
|
def last_error_event
|
88
96
|
post = last_error_event_post
|
89
|
-
assert_equal(1, post.
|
90
|
-
post.
|
97
|
+
assert_equal(1, post.events.size)
|
98
|
+
post.events.last
|
91
99
|
end
|
92
100
|
|
93
101
|
def last_error_event_post
|
@@ -0,0 +1,31 @@
|
|
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 TransactionEventsTest < Minitest::Test
|
6
|
+
include MultiverseHelpers
|
7
|
+
|
8
|
+
setup_and_teardown_agent
|
9
|
+
|
10
|
+
def test_transaction_event_error_flag_is_set
|
11
|
+
in_transaction :transaction_name => "Controller/blogs/index" do |t|
|
12
|
+
t.notice_error RuntimeError.new "Big Controller"
|
13
|
+
end
|
14
|
+
|
15
|
+
NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
|
16
|
+
|
17
|
+
intrinsics, _, _ = last_transaction_event
|
18
|
+
|
19
|
+
assert intrinsics["error"], "Expected the error flag to be true"
|
20
|
+
end
|
21
|
+
|
22
|
+
def last_transaction_event
|
23
|
+
post = last_transaction_event_post
|
24
|
+
assert_equal(1, post.events.size)
|
25
|
+
post.events.last
|
26
|
+
end
|
27
|
+
|
28
|
+
def last_transaction_event_post
|
29
|
+
$collector.calls_for(:analytic_event_data).first
|
30
|
+
end
|
31
|
+
end
|
@@ -54,6 +54,8 @@ class UtilizationDataCollectionTest < Minitest::Test
|
|
54
54
|
NewRelic::Agent::Hostname.stubs(:get).returns("host")
|
55
55
|
NewRelic::Agent::SystemInfo.stubs(:num_logical_processors).returns(5)
|
56
56
|
NewRelic::Agent::SystemInfo.stubs(:ram_in_mib).returns(128)
|
57
|
+
NewRelic::Agent::SystemInfo.stubs(:docker_container_id).returns(nil)
|
58
|
+
NewRelic::Agent::AWSInfo.any_instance.stubs(:loaded?).returns(false)
|
57
59
|
|
58
60
|
# this will trigger the agent to connect and send utilization data
|
59
61
|
setup_agent
|